9 namespace Friendica\Test\src\Content;
11 use Friendica\Content\Smilies;
12 use Friendica\Network\HTTPException\InternalServerErrorException;
13 use Friendica\Test\MockedTest;
14 use Friendica\Test\Util\AppMockTrait;
15 use Friendica\Test\Util\VFSTrait;
17 class SmiliesTest extends MockedTest
22 protected function setUp(): void
26 $this->mockApp($this->root);
27 $this->app->videowidth = 425;
28 $this->app->videoheight = 350;
29 $this->configMock->shouldReceive('get')
30 ->with('system', 'no_smilies')
32 $this->configMock->shouldReceive('get')
33 ->with(false, 'system', 'no_smilies')
37 public function dataLinks()
40 /** @see https://github.com/friendica/friendica/pull/6933 */
42 'data' => '<code>/</code>',
43 'smilies' => ['texts' => [], 'icons' => []],
44 'expected' => '<code>/</code>',
47 'data' => '<code>code</code>',
48 'smilies' => ['texts' => [], 'icons' => []],
49 'expected' => '<code>code</code>',
55 * Test replace smilies in different texts
57 * @dataProvider dataLinks
59 * @param string $text Test string
60 * @param array $smilies List of smilies to replace
61 * @param string $expected Expected result
63 * @throws InternalServerErrorException
65 public function testReplaceFromArray(string $text, array $smilies, string $expected)
67 $output = Smilies::replaceFromArray($text, $smilies);
68 self::assertEquals($expected, $output);