]> git.mxchange.org Git - friendica.git/commitdiff
Fix tests
authorPhilipp <admin@philipp.info>
Sat, 27 Nov 2021 18:03:01 +0000 (19:03 +0100)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sun, 28 Nov 2021 03:25:41 +0000 (22:25 -0500)
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

index ef93de3ef13ef3f3edd22bee464b1926e7fa0c2a..b5e2a4166517a6e796c45ff17027ae57790d3683 100644 (file)
@@ -69,8 +69,6 @@ XML;
                $notification = new Notification(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'xml']);
                $response = $notification->run();
 
-               print_r($response->getHeaders());
-
                self::assertXmlStringEqualsXmlString($assertXml, (string)$response->getBody());
                self::assertEquals(['Content-type' => ['text/xml'], ICanCreateResponses::X_HEADER => ['xml']], $response->getHeaders());
        }
index 42e3f77c04ffbb837ab08bee5256b92562737a44..108802c93a7e4e973b87a40e672a0414170e53f0 100644 (file)
@@ -21,6 +21,7 @@
 
 namespace Friendica\Test\src\Module\Api\Friendica\Photo;
 
+use Friendica\App\Router;
 use Friendica\DI;
 use Friendica\Module\Api\Friendica\Photo\Delete;
 use Friendica\Network\HTTPException\BadRequestException;
@@ -31,7 +32,7 @@ class DeleteTest extends ApiTest
        public function testEmpty()
        {
                $this->expectException(BadRequestException::class);
-               (new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))->run();
+               (new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))->run();
        }
 
        public function testWithoutAuthenticatedUser()
@@ -42,7 +43,7 @@ class DeleteTest extends ApiTest
        public function testWrong()
        {
                $this->expectException(BadRequestException::class);
-               (new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))->run(['photo_id' => 1]);
+               (new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))->run(['photo_id' => 1]);
        }
 
        public function testWithCorrectPhotoId()
index 118257c55bb6b3b55f7c95722a2a32fe54a6c9e2..5aa9b73ff51b35dadea132ad2ef8db699a7d0a05 100644 (file)
@@ -21,6 +21,7 @@
 
 namespace Friendica\Test\src\Module\Api\Friendica\Photoalbum;
 
+use Friendica\App\Router;
 use Friendica\DI;
 use Friendica\Module\Api\Friendica\Photoalbum\Delete;
 use Friendica\Network\HTTPException\BadRequestException;
@@ -31,14 +32,14 @@ class DeleteTest extends ApiTest
        public function testEmpty()
        {
                $this->expectException(BadRequestException::class);
-               (new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))->run();
+               (new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))->run();
 
        }
 
        public function testWrong()
        {
                $this->expectException(BadRequestException::class);
-               (new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))->run(['album' => 'album_name']);
+               (new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))->run(['album' => 'album_name']);
        }
 
        public function testValid()
index 464845745fa9e4cd62775fbc34a09121987f9d51..7a90012bb97e5d23d4648212ff5d2ee92f7e2cfd 100644 (file)
@@ -21,6 +21,7 @@
 
 namespace Friendica\Test\src\Module\Api\Friendica\Photoalbum;
 
+use Friendica\App\Router;
 use Friendica\DI;
 use Friendica\Module\Api\Friendica\Photoalbum\Update;
 use Friendica\Network\HTTPException\BadRequestException;
@@ -31,19 +32,19 @@ class UpdateTest extends ApiTest
        public function testEmpty()
        {
                $this->expectException(BadRequestException::class);
-               (new Update(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))->run();
+               (new Update(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))->run();
        }
 
        public function testTooFewArgs()
        {
                $this->expectException(BadRequestException::class);
-               (new Update(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))->run(['album' => 'album_name']);
+               (new Update(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))->run(['album' => 'album_name']);
        }
 
        public function testWrongUpdate()
        {
                $this->expectException(BadRequestException::class);
-               (new Update(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), []))->run(['album' => 'album_name', 'album_new' => 'album_name']);
+               (new Update(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))->run(['album' => 'album_name', 'album_new' => 'album_name']);
        }
 
        public function testWithoutAuthenticatedUser()