X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=tests%2Fsrc%2FModule%2FApi%2FGnuSocial%2FHelp%2FTestTest.php;h=1b7934a1969d7c0781944940eda9069f3fa6e9ec;hb=1874a32728142f2c12724562eb122eb1cd1370fe;hp=40d8e9750e1e79eea305ccd267d879aacb3edba4;hpb=645e4edc63a6b4cb273e06590a77f99619037e7b;p=friendica.git diff --git a/tests/src/Module/Api/GnuSocial/Help/TestTest.php b/tests/src/Module/Api/GnuSocial/Help/TestTest.php index 40d8e9750e..1b7934a196 100644 --- a/tests/src/Module/Api/GnuSocial/Help/TestTest.php +++ b/tests/src/Module/Api/GnuSocial/Help/TestTest.php @@ -1,27 +1,56 @@ . + * + */ namespace Friendica\Test\src\Module\Api\GnuSocial\Help; +use Friendica\Capabilities\ICanCreateResponses; use Friendica\DI; use Friendica\Module\Api\GNUSocial\Help\Test; use Friendica\Test\src\Module\Api\ApiTest; -use Friendica\Test\Util\ApiResponseDouble; class TestTest extends ApiTest { public function testJson() { - $test = new Test(DI::l10n(), ['extension' => 'json']); - $test->rawContent(); + $response = (new Test(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json'])) + ->run($this->httpExceptionMock); - self::assertEquals('"ok"', ApiResponseDouble::getOutput()); + $json = $this->toJson($response); + + self::assertEquals([ + 'Content-type' => ['application/json'], + ICanCreateResponses::X_HEADER => ['json'] + ], $response->getHeaders()); + self::assertEquals('ok', $json); } public function testXml() { - $test = new Test(DI::l10n(), ['extension' => 'xml']); - $test->rawContent(); + $response = (new Test(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'xml'])) + ->run($this->httpExceptionMock); - self::assertxml(ApiResponseDouble::getOutput(), 'ok'); + self::assertEquals([ + 'Content-type' => ['text/xml'], + ICanCreateResponses::X_HEADER => ['xml'] + ], $response->getHeaders()); + self::assertxml($response->getBody(), 'ok'); } }