]> git.mxchange.org Git - friendica.git/blob - tests/src/Module/Api/GnuSocial/Help/TestTest.php
4c9e0c169e4b9b56ed890bd6022842514e399c71
[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                 $response = (new Test(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']))
15                         ->run();
16
17                 $json = $this->toJson($response);
18
19                 self::assertEquals([
20                         'Content-type'                => ['application/json'],
21                         ICanCreateResponses::X_HEADER => ['json']
22                 ], $response->getHeaders());
23                 self::assertEquals('ok', $json);
24         }
25
26         public function testXml()
27         {
28                 $response = (new Test(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'xml']))
29                         ->run();
30
31                 self::assertEquals([
32                         'Content-type'                => ['text/xml'],
33                         ICanCreateResponses::X_HEADER => ['xml']
34                 ], $response->getHeaders());
35                 self::assertxml($response->getBody(), 'ok');
36         }
37 }