From f2ca21935e8c76b3e417efb6ddf5ebef7a8df292 Mon Sep 17 00:00:00 2001 From: Philipp Date: Fri, 12 Nov 2021 21:12:00 +0100 Subject: [PATCH] Move API\Photo testcases --- tests/legacy/ApiTest.php | 45 ------------------- .../Module/Api/Friendica/Photo/DeleteTest.php | 11 +++-- .../Api/Friendica/Photoalbum/DeleteTest.php | 27 +++++++++++ .../{Photo => Photoalbum}/UpdateTest.php | 4 +- 4 files changed, 37 insertions(+), 50 deletions(-) create mode 100644 tests/src/Module/Api/Friendica/Photoalbum/DeleteTest.php rename tests/src/Module/Api/Friendica/{Photo => Photoalbum}/UpdateTest.php (88%) diff --git a/tests/legacy/ApiTest.php b/tests/legacy/ApiTest.php index 645c078a46..1a88e6403f 100644 --- a/tests/legacy/ApiTest.php +++ b/tests/legacy/ApiTest.php @@ -3254,51 +3254,6 @@ class ApiTest extends FixtureTest $this->markTestIncomplete(); } - /** - * Test the api_fr_photo_delete() function. - * - * @return void - */ - public function testApiFrPhotoDelete() - { - // $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); - // api_fr_photo_delete('json'); - } - - /** - * Test the api_fr_photo_delete() function without an authenticated user. - * - * @return void - */ - public function testApiFrPhotoDeleteWithoutAuthenticatedUser() - { - // $this->expectException(\Friendica\Network\HTTPException\ForbiddenException::class); - // $_SESSION['authenticated'] = false; - // api_fr_photo_delete('json'); - } - - /** - * Test the api_fr_photo_delete() function with a photo ID. - * - * @return void - */ - public function testApiFrPhotoDeleteWithPhotoId() - { - // $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class); - // $_REQUEST['photo_id'] = 1; - // api_fr_photo_delete('json'); - } - - /** - * Test the api_fr_photo_delete() function with a correct photo ID. - * - * @return void - */ - public function testApiFrPhotoDeleteWithCorrectPhotoId() - { - $this->markTestIncomplete('We need to create a dataset for this.'); - } - /** * Test the api_fr_photo_detail() function. * diff --git a/tests/src/Module/Api/Friendica/Photo/DeleteTest.php b/tests/src/Module/Api/Friendica/Photo/DeleteTest.php index 69e9dbd314..a47c87e98a 100644 --- a/tests/src/Module/Api/Friendica/Photo/DeleteTest.php +++ b/tests/src/Module/Api/Friendica/Photo/DeleteTest.php @@ -2,7 +2,7 @@ namespace Friendica\Test\src\Module\Api\Friendica\Photo; -use Friendica\Module\Api\Friendica\Photoalbum\Delete; +use Friendica\Module\Api\Friendica\Photo\Delete; use Friendica\Network\HTTPException\BadRequestException; use Friendica\Test\src\Module\Api\ApiTest; @@ -14,13 +14,18 @@ class DeleteTest extends ApiTest Delete::rawContent(); } + public function testWithoutAuthenticatedUser() + { + self::markTestIncomplete('Needs BasicAuth as dynamic method for overriding first'); + } + public function testWrong() { self::expectException(BadRequestException::class); - Delete::rawContent(['album' => 'album_name']); + Delete::rawContent(['photo_id' => 1]); } - public function testValid() + public function testWithCorrectPhotoId() { self::markTestIncomplete('We need to add a dataset for this.'); } diff --git a/tests/src/Module/Api/Friendica/Photoalbum/DeleteTest.php b/tests/src/Module/Api/Friendica/Photoalbum/DeleteTest.php new file mode 100644 index 0000000000..ed9cd11578 --- /dev/null +++ b/tests/src/Module/Api/Friendica/Photoalbum/DeleteTest.php @@ -0,0 +1,27 @@ + 'album_name']); + } + + public function testValid() + { + self::markTestIncomplete('We need to add a dataset for this.'); + } +} diff --git a/tests/src/Module/Api/Friendica/Photo/UpdateTest.php b/tests/src/Module/Api/Friendica/Photoalbum/UpdateTest.php similarity index 88% rename from tests/src/Module/Api/Friendica/Photo/UpdateTest.php rename to tests/src/Module/Api/Friendica/Photoalbum/UpdateTest.php index f233998731..93c1cdc866 100644 --- a/tests/src/Module/Api/Friendica/Photo/UpdateTest.php +++ b/tests/src/Module/Api/Friendica/Photoalbum/UpdateTest.php @@ -1,6 +1,6 @@ 'album_name', 'album_new' => 'album_name']); } - public function testUpdateWithoutAuthenticatedUser() + public function testWithoutAuthenticatedUser() { self::markTestIncomplete('Needs BasicAuth as dynamic method for overriding first'); }