]> git.mxchange.org Git - friendica.git/blob - tests/src/Module/Api/GnuSocial/Help/TestTest.php
Fixing Response
[friendica.git] / tests / src / Module / Api / GnuSocial / Help / TestTest.php
1 <?php
2
3 namespace Friendica\Test\src\Module\Api\GnuSocial\Help;
4
5 use Friendica\Capabilities\ICanCreateResponses;
6 use Friendica\DI;
7 use Friendica\Module\Api\GNUSocial\Help\Test;
8 use Friendica\Test\src\Module\Api\ApiTest;
9
10 class TestTest extends ApiTest
11 {
12         public function testJson()
13         {
14                 $test = new Test(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']);
15                 $response = $test->run();
16
17                 self::assertEquals(['Content-type' => ['application/json'], ICanCreateResponses::X_HEADER => ['json']], $response->getHeaders());
18                 self::assertEquals('"ok"', $response->getBody());
19         }
20
21         public function testXml()
22         {
23                 $test = new Test(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'xml']);
24                 $response = $test->run();
25
26                 self::assertEquals(['Content-type' => ['text/xml'], ICanCreateResponses::X_HEADER => ['xml']], $response->getHeaders());
27                 self::assertxml($response->getBody(), 'ok');
28         }
29 }