]> git.mxchange.org Git - friendica.git/commitdiff
Added test
authorMichael <heluecht@pirati.ca>
Sun, 18 May 2025 12:29:46 +0000 (12:29 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 18 May 2025 13:35:25 +0000 (13:35 +0000)
tests/datasets/api.fixture.php
tests/src/Content/Text/BBCodeTest.php

index 15967261148f58e3f01179ce92ad6ea367de908f..5a31cfb3b9b784951b145c1ebbf2483b162367a8 100644 (file)
@@ -13,11 +13,11 @@ use Friendica\Model\Notification;
 return [
        'gserver' => [
                [
-                       'url' => 'https://friendica.local',
-                       'nurl' => 'http://friendica.local',
-                       'register_policy' => 0,
+                       'url'              => 'https://friendica.local',
+                       'nurl'             => 'http://friendica.local',
+                       'register_policy'  => 0,
                        'registered-users' => 0,
-                       'network' => 'unkn',
+                       'network'          => 'unkn',
                ],
        ],
        // Base test config to avoid notice messages
@@ -88,6 +88,11 @@ return [
                        'uri'  => 'https://friendica.local/profile/mutualcontact',
                        'guid' => '46',
                ],
+               [
+                       'id'   => 49,
+                       'uri'  => 'https://domain.tld/profile/remotecontact',
+                       'guid' => '49',
+               ],
                [
                        'id'   => 100,
                        'uri'  => 'https://friendica.local/posts/100',
@@ -214,6 +219,23 @@ return [
                        'network'  => Protocol::DFRN,
                        'location' => 'DFRN',
                ],
+               [
+                       'id'       => 49,
+                       'uid'      => 0,
+                       'uri-id'   => 43,
+                       'name'     => 'Remote user',
+                       'nick'     => 'remotecontact',
+                       'self'     => 0,
+                       'nurl'     => 'http://domain.tld/profile/remotecontact',
+                       'url'      => 'https://domain.tld/profile/remotecontact',
+                       'alias'    => 'https://domain.tld/~remotecontact',
+                       'about'    => 'User used in tests',
+                       'pending'  => 0,
+                       'blocked'  => 0,
+                       'rel'      => Contact::FOLLOWER,
+                       'network'  => Protocol::ACTIVITYPUB,
+                       'location' => 'AP',
+               ],
        ],
        'apcontact' => [
                [
@@ -343,7 +365,7 @@ return [
                                                'suscipit aut facilis ut inventore omnis exercitationem quo magnam ' .
                                                'consequatur maxime aut illum soluta quaerat natus unde aspernatur ' .
                                                'et sed beatae nihil ullam temporibus corporis ratione blanditiis',
-                       'plink'  => 'https://friendica.local/display/6',
+                       'plink' => 'https://friendica.local/display/6',
                ],
                [
                        'uri-id' => 100,
@@ -912,8 +934,8 @@ return [
        ],
        'profile' => [
                [
-                       'id'  => 1,
-                       'uid' => 42,
+                       'id'       => 1,
+                       'uid'      => 42,
                        'locality' => 'DFRN',
                ],
        ],
@@ -933,18 +955,18 @@ return [
        ],
        'group_member' => [
                [
-                       'id' => 1,
-                       'gid' => 1,
+                       'id'         => 1,
+                       'gid'        => 1,
                        'contact-id' => 43,
                ],
                [
-                       'id' => 2,
-                       'gid' => 1,
+                       'id'         => 2,
+                       'gid'        => 1,
                        'contact-id' => 43,
                ],
                [
-                       'id' => 3,
-                       'gid' => 2,
+                       'id'         => 3,
+                       'gid'        => 2,
                        'contact-id' => 43,
                ],
        ],
index 9c61e10887a1b1eb1bafbf458a279884f22d4b6e..c7c7220cd94b58d4eee39810d249585dd70cc85e 100644 (file)
@@ -615,4 +615,27 @@ Lucas: For the right price, yes.[/share]',
 
                self::assertEquals($expected, $actual);
        }
+
+       public function dataProfileLink(): array
+       {
+               return [
+                       'mention' => [
+                               'expected' => 'Test 1: <bdi>@<a href="https://domain.tld/~remotecontact" class="userinfo mention" title="Remote contact">Remote contact</a></bdi>',
+                               'text'     => 'Test 1: @[url=https://domain.tld/profile/remotecontact]Remote contact[/url]',
+                       ],
+               ];
+       }
+
+       /**
+        * @dataProvider dataProfileLink
+        *
+        * @param string $expected Expected BBCode output
+        * @param string $text     Input text
+        */
+       public function testProfileLink(string $expected, string $text)
+       {
+               $actual = BBCode::convertForUriId(0, $text);
+
+               self::assertEquals($expected, $actual);
+       }
 }