]> git.mxchange.org Git - friendica.git/commitdiff
Fix code style
authorArt4 <art4@wlabs.de>
Mon, 17 Feb 2025 10:01:25 +0000 (10:01 +0000)
committerArt4 <art4@wlabs.de>
Mon, 17 Feb 2025 10:01:25 +0000 (10:01 +0000)
tests/src/Content/SmiliesTest.php

index 2882eeb8d598d9ae7b607739781e890ec091d694..69236efe2d766d2b392d45491bbff4798c8305f7 100644 (file)
@@ -38,13 +38,13 @@ class SmiliesTest extends FixtureTestCase
                return [
                        /** @see https://github.com/friendica/friendica/pull/6933 */
                        'bug-6933-1' => [
-                               'data' => '<code>/</code>',
-                               'smilies' => ['texts' => [], 'icons' => []],
+                               'data'     => '<code>/</code>',
+                               'smilies'  => ['texts' => [], 'icons' => []],
                                'expected' => '<code>/</code>',
                        ],
                        'bug-6933-2' => [
-                               'data' => '<code>code</code>',
-                               'smilies' => ['texts' => [], 'icons' => []],
+                               'data'     => '<code>code</code>',
+                               'smilies'  => ['texts' => [], 'icons' => []],
                                'expected' => '<code>code</code>',
                        ],
                ];
@@ -72,56 +72,56 @@ class SmiliesTest extends FixtureTestCase
                return [
                        'emoji' => [
                                'expected' => true,
-                               'body' => '๐Ÿ‘€',
+                               'body'     => '๐Ÿ‘€',
                        ],
                        'emojis' => [
                                'expected' => true,
-                               'body' => '๐Ÿ‘€๐Ÿคท',
+                               'body'     => '๐Ÿ‘€๐Ÿคท',
                        ],
                        'emoji+whitespace' => [
                                'expected' => true,
-                               'body' => ' ๐Ÿ‘€ ',
+                               'body'     => ' ๐Ÿ‘€ ',
                        ],
                        'empty' => [
                                'expected' => false,
-                               'body' => '',
+                               'body'     => '',
                        ],
                        'whitespace' => [
                                'expected' => false,
-                               'body' => '
+                               'body'     => '
                                ',
                        ],
                        'emoji+ASCII' => [
                                'expected' => false,
-                               'body' => '๐Ÿคทa',
+                               'body'     => '๐Ÿคทa',
                        ],
                        'HTML entity whitespace' => [
                                'expected' => false,
-                               'body' => '&nbsp;',
+                               'body'     => '&nbsp;',
                        ],
                        'HTML entity else' => [
                                'expected' => false,
-                               'body' => '&deg;',
+                               'body'     => '&deg;',
                        ],
                        'emojis+HTML whitespace' => [
                                'expected' => true,
-                               'body' => '๐Ÿ‘€&nbsp;๐Ÿคท',
+                               'body'     => '๐Ÿ‘€&nbsp;๐Ÿคท',
                        ],
                        'emojis+HTML else' => [
                                'expected' => false,
-                               'body' => '๐Ÿ‘€&lt;๐Ÿคท',
+                               'body'     => '๐Ÿ‘€&lt;๐Ÿคท',
                        ],
                        'zwj' => [
                                'expected' => true,
-                               'body' => '๐Ÿ‘จโ€๐Ÿ‘จโ€๐Ÿ‘งโ€',
+                               'body'     => '๐Ÿ‘จโ€๐Ÿ‘จโ€๐Ÿ‘งโ€',
                        ],
                        'zwj+whitespace' => [
                                'expected' => true,
-                               'body' => ' ๐Ÿ‘จโ€๐Ÿ‘จโ€๐Ÿ‘งโ€ ',
+                               'body'     => ' ๐Ÿ‘จโ€๐Ÿ‘จโ€๐Ÿ‘งโ€ ',
                        ],
                        'zwj+HTML whitespace' => [
                                'expected' => true,
-                               'body' => '&nbsp;๐Ÿ‘จโ€๐Ÿ‘จโ€๐Ÿ‘งโ€&nbsp;',
+                               'body'     => '&nbsp;๐Ÿ‘จโ€๐Ÿ‘จโ€๐Ÿ‘งโ€&nbsp;',
                        ],
                ];
        }
@@ -139,59 +139,59 @@ class SmiliesTest extends FixtureTestCase
                $data = [
                        'simple-1' => [
                                'expected' => 'alt=":-p"',
-                               'body' => ':-p',
+                               'body'     => ':-p',
                        ],
                        'simple-2' => [
                                'expected' => 'alt=":-p"',
-                               'body' => ' :-p ',
+                               'body'     => ' :-p ',
                        ],
                        'word-boundary-1' => [
                                'expected' => ':-pppp',
-                               'body' => ':-pppp',
+                               'body'     => ':-pppp',
                        ],
                        'word-boundary-2' => [
                                'expected' => '~friendicaca',
-                               'body' => '~friendicaca',
+                               'body'     => '~friendicaca',
                        ],
                        'symbol-boundary-1' => [
                                'expected' => 'alt=":-p"',
-                               'body' => '(:-p)',
+                               'body'     => '(:-p)',
                        ],
                        'hearts-1' => [
                                'expected' => 'โค (โค) โค',
-                               'body' => '&lt;3 (&lt;3) &lt;3',
+                               'body'     => '&lt;3 (&lt;3) &lt;3',
                        ],
                        'hearts-8' => [
                                'expected' => '(โคโคโคโคโคโคโคโค)',
-                               'body' => '(&lt;33333333)',
+                               'body'     => '(&lt;33333333)',
                        ],
                        'no-hearts-1' => [
                                'expected' => '(&lt;30)',
-                               'body' => '(&lt;30)',
+                               'body'     => '(&lt;30)',
                        ],
                        'no-hearts-2' => [
                                'expected' => '(3&lt;33)',
-                               'body' => '(3&lt;33)',
+                               'body'     => '(3&lt;33)',
                        ],
                        'space' => [
                                'expected' => 'alt="smiley-heart"',
-                               'body' => ':smiley heart 333:',
+                               'body'     => ':smiley heart 333:',
                        ],
                        'substitution-1' => [
                                'expected' => '&#x1F525;',
-                               'body' => 'โฝ•',
+                               'body'     => 'โฝ•',
                        ],
                        'substitution-2' => [
                                'expected' => '&#x1F917;',
-                               'body' => ':hugging face:',
+                               'body'     => ':hugging face:',
                        ],
                        'substitution-3' => [
                                'expected' => '&#x1F92D;',
-                               'body' => ':face with hand over mouth:',
+                               'body'     => ':face with hand over mouth:',
                        ],
                        'mixed' => [
                                'expected' => '&#x1F525; &#x1F92D; invalid:hugging face: &#x1F917;',
-                               'body' => 'โฝ• :face with hand over mouth: invalid:hugging face: :hugging face:',
+                               'body'     => 'โฝ• :face with hand over mouth: invalid:hugging face: :hugging face:',
                        ],
                ];
 
@@ -199,10 +199,10 @@ class SmiliesTest extends FixtureTestCase
                        foreach (['A', '_', ':', '-'] as $prefix) {
                                foreach (['', ' ', 'A', ':', '-'] as $suffix) {
                                        $no_smile = ($prefix !== '' && ctype_alnum($prefix)) || ($suffix !== '' && ctype_alnum($suffix));
-                                       $s = $prefix . $emoji . $suffix;
-                                       $data[] = [
+                                       $s        = $prefix . $emoji . $suffix;
+                                       $data[]   = [
                                                'expected' => $no_smile ? $s : 'alt="' . $emoji . '"',
-                                               'body' => $s,
+                                               'body'     => $s,
                                        ];
                                }
                        }
@@ -223,58 +223,58 @@ class SmiliesTest extends FixtureTestCase
        {
                return [
                        'symbols' => [
-                               'expected' => ['p', 'heart', 'embarrassed', 'kiss'],
-                               'body' => ':-p &lt;3 ":-[:-"',
+                               'expected'   => ['p', 'heart', 'embarrassed', 'kiss'],
+                               'body'       => ':-p &lt;3 ":-[:-"',
                                'normalized' => ':p: :heart: ":embarrassed::kiss:',
                        ],
                        'single-smiley' => [
-                               'expected' => ['like'],
-                               'body' => ':like',
+                               'expected'   => ['like'],
+                               'body'       => ':like',
                                'normalized' => ':like:',
                        ],
                        'multiple-smilies' => [
-                               'expected' => ['like', 'dislike'],
-                               'body' => ':like :dislike',
+                               'expected'   => ['like', 'dislike'],
+                               'body'       => ':like :dislike',
                                'normalized' => ':like: :dislike:',
                        ],
                        'nosmile' => [
-                               'expected' => [],
-                               'body' => '[nosmile] :like :like',
+                               'expected'   => [],
+                               'body'       => '[nosmile] :like :like',
                                'normalized' => '[nosmile] :like :like'
                        ],
                        'in-code' => [
-                               'expected' => [],
-                               'body' => '[code]:like :like :like[/code]',
+                               'expected'   => [],
+                               'body'       => '[code]:like :like :like[/code]',
                                'normalized' => '[code]:like :like :like[/code]'
                        ],
                        '~friendica' => [
-                               'expected' => ['friendica'],
-                               'body' => '~friendica',
+                               'expected'   => ['friendica'],
+                               'body'       => '~friendica',
                                'normalized' => ':friendica:'
                        ],
                        'space' => [
-                               'expected' => ['smileyheart333'],
-                               'body' => ':smiley heart 333:',
+                               'expected'   => ['smileyheart333'],
+                               'body'       => ':smiley heart 333:',
                                'normalized' => ':smileyheart333:'
                        ],
                        'substitution-1' => [
-                               'expected' => [],
-                               'body' => 'โฝ•',
+                               'expected'   => [],
+                               'body'       => 'โฝ•',
                                'normalized' => '&#x1F525;',
                        ],
                        'substitution-2' => [
-                               'expected' => [],
-                               'body' => ':hugging face:',
+                               'expected'   => [],
+                               'body'       => ':hugging face:',
                                'normalized' => '&#x1F917;',
                        ],
                        'substitution-3' => [
-                               'expected' => [],
-                               'body' => ':face with hand over mouth:',
+                               'expected'   => [],
+                               'body'       => ':face with hand over mouth:',
                                'normalized' => '&#x1F92D;',
                        ],
                        'mixed' => [
-                               'expected' => [],
-                               'body' => 'โฝ• :face with hand over mouth: invalid:hugging face: :hugging face:',
+                               'expected'   => [],
+                               'body'       => 'โฝ• :face with hand over mouth: invalid:hugging face: :hugging face:',
                                'normalized' => '&#x1F525; &#x1F92D; invalid:hugging face: &#x1F917;',
                        ],
                ];
@@ -286,7 +286,7 @@ class SmiliesTest extends FixtureTestCase
        public function testExtractUsedSmilies(array $expected, string $body, string $normalized): void
        {
                $extracted = Smilies::extractUsedSmilies($body, $converted);
-               $expected = array_fill_keys($expected, true);
+               $expected  = array_fill_keys($expected, true);
                $this->assertEquals($normalized, $converted);
                foreach (array_keys($extracted) as $shortcode) {
                        $this->assertArrayHasKey($shortcode, $expected);