]> git.mxchange.org Git - friendica.git/commitdiff
Adapt API tests for dynamic usage
authorPhilipp <admin@philipp.info>
Sun, 14 Nov 2021 22:35:01 +0000 (23:35 +0100)
committerPhilipp <admin@philipp.info>
Sun, 14 Nov 2021 22:49:07 +0000 (23:49 +0100)
tests/src/Module/Api/Friendica/NotificationTest.php
tests/src/Module/Api/Friendica/Photo/DeleteTest.php
tests/src/Module/Api/Friendica/Photoalbum/DeleteTest.php
tests/src/Module/Api/Friendica/Photoalbum/UpdateTest.php
tests/src/Module/Api/GnuSocial/GnuSocial/VersionTest.php
tests/src/Module/Api/GnuSocial/Help/TestTest.php
tests/src/Module/Api/Twitter/Account/RateLimitStatusTest.php
tests/src/Module/Api/Twitter/SavedSearchesTest.php

index 7a213e2a5bffb91d33a246b6b08e6bf32e14ae51..7f1fd701fab9b8d20422e51aa2a072528a5418e1 100644 (file)
@@ -67,14 +67,16 @@ class NotificationTest extends ApiTest
 </notes>
 XML;
 
-               Notification::rawContent(['extension' => 'xml']);
+               $notification = new Notification(['extension' => 'xml']);
+               $notification->rawContent();
 
                self::assertXmlStringEqualsXmlString($assertXml, ApiResponseDouble::getOutput());
        }
 
        public function testWithJsonResult()
        {
-               Notification::rawContent(['parameter' => 'json']);
+               $notification = new Notification(['parameter' => 'json']);
+               $notification->rawContent();
 
                $result = json_encode(ApiResponseDouble::getOutput());
 
index 3fd1d92f7231359d2c4568f7cbddb4a1937a6d96..5581c9cc2e6be05fd7fbfe4d94c41a380a4ac254 100644 (file)
@@ -30,7 +30,7 @@ class DeleteTest extends ApiTest
        public function testEmpty()
        {
                $this->expectException(BadRequestException::class);
-               Delete::rawContent();
+               (new Delete())->rawContent();
        }
 
        public function testWithoutAuthenticatedUser()
@@ -41,7 +41,7 @@ class DeleteTest extends ApiTest
        public function testWrong()
        {
                $this->expectException(BadRequestException::class);
-               Delete::rawContent(['photo_id' => 1]);
+               (new Delete(['photo_id' => 1]))->rawContent();
        }
 
        public function testWithCorrectPhotoId()
index f99e61bd1b5ccdad020f3c1a96937287818c8b18..6ee3c5e7b5bcd474f9f341e961bb60914c554230 100644 (file)
@@ -30,13 +30,13 @@ class DeleteTest extends ApiTest
        public function testEmpty()
        {
                $this->expectException(BadRequestException::class);
-               Delete::rawContent();
+               (new Delete())->rawContent();
        }
 
        public function testWrong()
        {
                $this->expectException(BadRequestException::class);
-               Delete::rawContent(['album' => 'album_name']);
+               (new Delete(['album' => 'album_name']))->rawContent();
        }
 
        public function testValid()
index b07d4c5bcf6126466f464a9f93ee71450545eece..c7d65cb16bcdfe4050719684bb68845ce766562e 100644 (file)
@@ -30,19 +30,19 @@ class UpdateTest extends ApiTest
        public function testEmpty()
        {
                $this->expectException(BadRequestException::class);
-               Update::rawContent();
+               (new Update())->rawContent();
        }
 
        public function testTooFewArgs()
        {
                $this->expectException(BadRequestException::class);
-               Update::rawContent(['album' => 'album_name']);
+               (new Update(['album' => 'album_name']))->rawContent();
        }
 
        public function testWrongUpdate()
        {
                $this->expectException(BadRequestException::class);
-               Update::rawContent(['album' => 'album_name', 'album_new' => 'album_name']);
+               (new Update(['album' => 'album_name', 'album_new' => 'album_name']))->rawContent();
        }
 
        public function testWithoutAuthenticatedUser()
index 454b8ef40da35211b47bcfa86f30ae871003154f..a819a7a1e6c3c26949a0a6bbe5c7a24c1cefe353 100644 (file)
@@ -10,7 +10,8 @@ class VersionTest extends ApiTest
 {
        public function test()
        {
-               Version::rawContent(['extension' => 'json']);
+               $version = new Version(['extension' => 'json']);
+               $version->rawContent();
 
                $result = json_decode(ApiResponseDouble::getOutput());
 
index c962cac302f4423aab2b54a117daed07ba9e04d5..c624ca0326fcd8b2aea79285c0cbc58bd816dab1 100644 (file)
@@ -10,14 +10,16 @@ class TestTest extends ApiTest
 {
        public function testJson()
        {
-               Test::rawContent(['extension' => 'json']);
+               $test = new Test(['extension' => 'json']);
+               $test->rawContent();
 
                self::assertEquals('"ok"', ApiResponseDouble::getOutput());
        }
 
        public function testXml()
        {
-               Test::rawContent(['extension' => 'xml']);
+               $test = new Test(['extension' => 'xml']);
+               $test->rawContent();
 
                self::assertxml(ApiResponseDouble::getOutput(), 'ok');
        }
index 46088d330f5e9e85e69076c1691f1c7f28e47e07..3a84324af53774d52b8dc9360bd8f06941895d50 100644 (file)
@@ -10,7 +10,8 @@ class RateLimitStatusTest extends ApiTest
 {
        public function testWithJson()
        {
-               RateLimitStatus::rawContent(['extension' => 'json']);
+               $rateLimitStatus = new RateLimitStatus(['extension' => 'json']);
+               $rateLimitStatus->rawContent();
 
                $result = json_decode(ApiResponseDouble::getOutput());
 
@@ -21,7 +22,8 @@ class RateLimitStatusTest extends ApiTest
 
        public function testWithXml()
        {
-               RateLimitStatus::rawContent(['extension' => 'xml']);
+               $rateLimitStatus = new RateLimitStatus(['extension' => 'xml']);
+               $rateLimitStatus->rawContent();
 
                self::assertXml(ApiResponseDouble::getOutput(), 'hash');
        }
index f4dad04fc187a12c9b55e6341388b5a803ad976c..fc0f80467bda5064cd0e324d1c40373ba5a3bce3 100644 (file)
@@ -10,7 +10,8 @@ class SavedSearchesTest extends ApiTest
 {
        public function test()
        {
-               SavedSearches::rawContent(['extension' => 'json']);
+               $savedSearch = new SavedSearches(['extension' => 'json']);
+               $savedSearch->rawContent();
 
                $result = json_decode(ApiResponseDouble::getOutput());