friendica/tests/src/Module/Api/GnuSocial/Help/TestTest.php

30 lines
1 KiB
PHP
Raw Normal View History

2021-11-12 22:03:41 +01:00
<?php
namespace Friendica\Test\src\Module\Api\GnuSocial\Help;
2021-11-22 00:07:09 +01:00
use Friendica\Capabilities\ICanCreateResponses;
use Friendica\DI;
2021-11-12 22:03:41 +01:00
use Friendica\Module\Api\GNUSocial\Help\Test;
use Friendica\Test\src\Module\Api\ApiTest;
class TestTest extends ApiTest
{
public function testJson()
{
2021-11-21 21:52:36 +01:00
$test = new Test(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']);
$response = $test->run();
2021-11-12 22:03:41 +01:00
2021-11-22 00:07:09 +01:00
self::assertEquals(['Content-type' => ['application/json'], ICanCreateResponses::X_HEADER => ['json']], $response->getHeaders());
self::assertEquals('"ok"', $response->getBody());
2021-11-12 22:03:41 +01:00
}
public function testXml()
{
2021-11-21 21:52:36 +01:00
$test = new Test(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'xml']);
$response = $test->run();
2021-11-12 22:03:41 +01:00
2021-11-22 00:07:09 +01:00
self::assertEquals(['Content-type' => ['text/xml'], ICanCreateResponses::X_HEADER => ['xml']], $response->getHeaders());
self::assertxml($response->getBody(), 'ok');
2021-11-12 22:03:41 +01:00
}
}