9 namespace Friendica\Test\src\Content;
11 use Friendica\Content\Smilies;
12 use Friendica\Test\MockedTest;
13 use Friendica\Test\Util\AppMockTrait;
14 use Friendica\Test\Util\VFSTrait;
16 class SmiliesTest extends MockedTest
21 protected function setUp()
25 $this->mockApp($this->root);
26 $this->app->videowidth = 425;
27 $this->app->videoheight = 350;
28 $this->configMock->shouldReceive('get')
29 ->with('system', 'no_smilies')
31 $this->configMock->shouldReceive('get')
32 ->with(false, 'system', 'no_smilies')
36 public function dataLinks()
39 /** @see https://github.com/friendica/friendica/pull/6933 */
41 'data' => '<code>/</code>',
42 'smilies' => ['texts' => [], 'icons' => []],
43 'expected' => '<code>/</code>',
46 'data' => '<code>code</code>',
47 'smilies' => ['texts' => [], 'icons' => []],
48 'expected' => '<code>code</code>',
54 * Test replace smilies in different texts
55 * @dataProvider dataLinks
57 * @param string $text Test string
58 * @param array $smilies List of smilies to replace
59 * @param string $expected Expected result
60 * @throws \Friendica\Network\HTTPException\InternalServerErrorException
62 public function testReplaceFromArray($text, $smilies, $expected)
64 $output = Smilies::replaceFromArray($text, $smilies);
65 $this->assertEquals($expected, $output);