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->configMock->shouldReceive('get')
28 ->with('system', 'no_smilies')
30 $this->configMock->shouldReceive('get')
31 ->with(false, 'system', 'no_smilies')
35 public function dataLinks()
38 /** @see https://github.com/friendica/friendica/pull/6933 */
40 'data' => '<code>/</code>',
41 'smilies' => ['texts' => [], 'icons' => []],
42 'expected' => '<code>/</code>',
45 'data' => '<code>code</code>',
46 'smilies' => ['texts' => [], 'icons' => []],
47 'expected' => '<code>code</code>',
53 * 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
61 * @throws InternalServerErrorException
63 public function testReplaceFromArray(string $text, array $smilies, string $expected)
65 $output = Smilies::replaceFromArray($text, $smilies);
66 self::assertEquals($expected, $output);