--- /dev/null
+<?php\r
+/**\r
+ * Created by PhpStorm.\r
+ * User: benlo\r
+ * Date: 25/03/19\r
+ * Time: 21:36\r
+ */\r
+\r
+namespace Friendica\Test\src\Content;\r
+\r
+use Friendica\Content\Smilies;\r
+use Friendica\Test\MockedTest;\r
+use Friendica\Test\Util\AppMockTrait;\r
+use Friendica\Test\Util\L10nMockTrait;\r
+use Friendica\Test\Util\VFSTrait;\r
+\r
+class SmiliesTest extends MockedTest\r
+{\r
+ use VFSTrait;\r
+ use AppMockTrait;\r
+ use L10nMockTrait;\r
+\r
+ protected function setUp()\r
+ {\r
+ parent::setUp();\r
+ $this->setUpVfsDir();\r
+ $this->mockApp($this->root);\r
+ $this->app->videowidth = 425;\r
+ $this->app->videoheight = 350;\r
+ $this->configMock->shouldReceive('get')\r
+ ->with('system', 'no_smilies')\r
+ ->andReturn(false);\r
+ $this->configMock->shouldReceive('get')\r
+ ->with(false, 'system', 'no_smilies')\r
+ ->andReturn(false);\r
+ }\r
+\r
+ public function dataLinks()\r
+ {\r
+ return [\r
+ /** @see https://github.com/friendica/friendica/pull/6933 */\r
+ 'bug-6933-1' => [\r
+ 'data' => '<code>/</code>',\r
+ 'smilies' => ['texts' => [], 'icons' => []],\r
+ 'expected' => '<code>/</code>',\r
+ ],\r
+ 'bug-6933-2' => [\r
+ 'data' => '<code>code</code>',\r
+ 'smilies' => ['texts' => [], 'icons' => []],\r
+ 'expected' => '<code>code</code>',\r
+ ],\r
+ ];\r
+ }\r
+\r
+ /**\r
+ * Test replace smilies in different texts\r
+ * @dataProvider dataLinks\r
+ *\r
+ * @param string $text Test string\r
+ * @param array $smilies List of smilies to replace\r
+ * @param string $expected Expected result\r
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException\r
+ */\r
+ public function testReplaceFromArray($text, $smilies, $expected)\r
+ {\r
+ $output = Smilies::replaceFromArray($text, $smilies);\r
+ $this->assertEquals($expected, $output);\r
+ }\r
+}\r