]> git.mxchange.org Git - friendica.git/commitdiff
Move another API status tests
authorPhilipp <admin@philipp.info>
Thu, 30 Dec 2021 21:17:03 +0000 (22:17 +0100)
committerPhilipp <admin@philipp.info>
Thu, 30 Dec 2021 21:17:03 +0000 (22:17 +0100)
tests/legacy/ApiTest.php
tests/src/Factory/Api/Twitter/StatusTest.php

index e4427c91945bd1ab584d5a018b50a97cdaa3c8f0..2186e36d6770df1480045db1ff460aadcb3c4bc5 100644 (file)
@@ -535,8 +535,6 @@ class ApiTest extends FixtureTest
                );
        }
 
-
-
        /**
         * Test the api_format_items_embeded_images() function.
         *
@@ -552,36 +550,6 @@ class ApiTest extends FixtureTest
                */
        }
 
-       /**
-        * Test the api_format_items() function.
-        * @doesNotPerformAssertions
-        */
-       public function testApiFormatItems()
-       {
-               /*
-               $items = Post::selectToArray([], ['uid' => 42]);
-               foreach ($items as $item) {
-                       $status = api_format_item($item);
-                       self::assertStatus($status);
-               }
-               */
-       }
-
-       /**
-        * Test the api_format_items() function with an XML result.
-        * @doesNotPerformAssertions
-        */
-       public function testApiFormatItemsWithXml()
-       {
-               /*
-               $items = Post::selectToArray([], ['uid' => 42]);
-               foreach ($items as $item) {
-                       $status = api_format_item($item, 'xml');
-                       self::assertStatus($status);
-               }
-               */
-       }
-
        /**
         * Test the api_lists_list() function.
         *
index b4ba6bf28a8563d4c516faa185eae5007ccd2553..61dcb0a9cbb4ae510cd3a112c8f143623df16ab2 100644 (file)
@@ -108,4 +108,28 @@ class StatusTest extends FixtureTest
                self::assertIsArray($status['entities']['urls']);
                self::assertIsArray($status['entities']['user_mentions']);
        }
+
+       /**
+        * Test the api_format_items() function.
+        */
+       public function testApiFormatItems()
+       {
+               $hashTagFac    = new Hashtag(DI::logger());
+               $mediaFac      = new Media(DI::logger(), DI::baseUrl());
+               $urlFac        = new Url(DI::logger());
+               $mentionFac    = new Mention(DI::logger(), DI::baseUrl());
+               $activitiesFac = new Activities(DI::logger(), DI::baseUrl(), DI::twitterUser());
+               $attachmentFac = new Attachment(DI::logger());
+
+               $statusFac = new Status(DI::logger(), DI::dba(), DI::twitterUser(), $hashTagFac, $mediaFac, $urlFac, $mentionFac, $activitiesFac, $attachmentFac);
+
+               $posts = DI::dba()->selectToArray('post-view', ['uri-id']);
+               foreach ($posts as $item) {
+                       $statusObj = $statusFac->createFromUriId($item['uri-id'], ApiTest::SELF_USER['id']);
+                       $status    = $statusObj->toArray();
+
+                       self::assertIsInt($status['id']);
+                       self::assertIsString($status['text']);
+               }
+       }
 }