setUpVfsDir();
$this->mockApp($this->root);
$this->configMock->shouldReceive('get')
->with('system', 'no_smilies')
->andReturn(false);
$this->configMock->shouldReceive('get')
->with(false, 'system', 'no_smilies')
->andReturn(false);
}
public function dataLinks()
{
return [
/** @see https://github.com/friendica/friendica/pull/6933 */
'bug-6933-1' => [
'data' => '/
',
'smilies' => ['texts' => [], 'icons' => []],
'expected' => '/
',
],
'bug-6933-2' => [
'data' => 'code
',
'smilies' => ['texts' => [], 'icons' => []],
'expected' => 'code
',
],
];
}
/**
* Test replace smilies in different texts
*
* @dataProvider dataLinks
*
* @param string $text Test string
* @param array $smilies List of smilies to replace
* @param string $expected Expected result
*
* @throws InternalServerErrorException
*/
public function testReplaceFromArray(string $text, array $smilies, string $expected)
{
$output = Smilies::replaceFromArray($text, $smilies);
self::assertEquals($expected, $output);
}
}