mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-10 09:04:26 +02:00
Fix substituting smilies and smilies containing whitespaces
This commit is contained in:
parent
5c3227ac4c
commit
37188c76b8
6 changed files with 154 additions and 91 deletions
|
@ -26,6 +26,7 @@
|
|||
namespace Friendica\Test\src\Content;
|
||||
|
||||
use Friendica\Content\Smilies;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\DI;
|
||||
use Friendica\Network\HTTPException\InternalServerErrorException;
|
||||
use Friendica\Test\FixtureTest;
|
||||
|
@ -37,6 +38,9 @@ class SmiliesTest extends FixtureTest
|
|||
parent::setUp();
|
||||
|
||||
DI::config()->set('system', 'no_smilies', false);
|
||||
|
||||
Hook::register('smilie', 'tests/Util/SmileyWhitespaceAddon.php', 'add_test_unicode_smilies');
|
||||
Hook::loadHooks();
|
||||
}
|
||||
|
||||
public function dataLinks()
|
||||
|
@ -184,6 +188,26 @@ class SmiliesTest extends FixtureTest
|
|||
'expected' => '(3<33)',
|
||||
'body' => '(3<33)',
|
||||
],
|
||||
'space' => [
|
||||
'expected' => 'alt="smiley-heart"',
|
||||
'body' => ':smiley heart 333:',
|
||||
],
|
||||
'substitution-1' => [
|
||||
'expected' => '🔥',
|
||||
'body' => '⽕',
|
||||
],
|
||||
'substitution-2' => [
|
||||
'expected' => '🤗',
|
||||
'body' => ':hugging face:',
|
||||
],
|
||||
'substitution-3' => [
|
||||
'expected' => '🤭',
|
||||
'body' => ':face with hand over mouth:',
|
||||
],
|
||||
'mixed' => [
|
||||
'expected' => '🔥 🤭 invalid:hugging face: 🤗',
|
||||
'body' => '⽕ :face with hand over mouth: invalid:hugging face: :hugging face:',
|
||||
],
|
||||
];
|
||||
foreach ([':-[', ':-D', 'o.O'] as $emoji) {
|
||||
foreach (['A', '_', ':', '-'] as $prefix) {
|
||||
|
@ -245,6 +269,31 @@ class SmiliesTest extends FixtureTest
|
|||
'body' => '~friendica',
|
||||
'normalized' => ':friendica:'
|
||||
],
|
||||
'space' => [
|
||||
'expected' => ['smileyheart333'],
|
||||
'body' => ':smiley heart 333:',
|
||||
'normalized' => ':smileyheart333:'
|
||||
],
|
||||
'substitution-1' => [
|
||||
'expected' => [],
|
||||
'body' => '⽕',
|
||||
'normalized' => '🔥',
|
||||
],
|
||||
'substitution-2' => [
|
||||
'expected' => [],
|
||||
'body' => ':hugging face:',
|
||||
'normalized' => '🤗',
|
||||
],
|
||||
'substitution-3' => [
|
||||
'expected' => [],
|
||||
'body' => ':face with hand over mouth:',
|
||||
'normalized' => '🤭',
|
||||
],
|
||||
'mixed' => [
|
||||
'expected' => [],
|
||||
'body' => '⽕ :face with hand over mouth: invalid:hugging face: :hugging face:',
|
||||
'normalized' => '🔥 🤭 invalid:hugging face: 🤗',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue