Add feedback - avoid intermediate variables

This commit is contained in:
Philipp 2022-01-02 01:04:04 +01:00
parent adf0d7bc95
commit 301ac83ebf
No known key found for this signature in database
GPG key ID: 24A7501396EB5432
42 changed files with 367 additions and 272 deletions

View file

@ -11,21 +11,27 @@ class TestTest extends ApiTest
{
public function testJson()
{
$test = new Test(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']);
$response = $test->run();
$response = (new Test(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']))
->run();
$json = $this->toJson($response);
self::assertEquals(['Content-type' => ['application/json'], ICanCreateResponses::X_HEADER => ['json']], $response->getHeaders());
self::assertEquals([
'Content-type' => ['application/json'],
ICanCreateResponses::X_HEADER => ['json']
], $response->getHeaders());
self::assertEquals('ok', $json);
}
public function testXml()
{
$test = new Test(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'xml']);
$response = $test->run();
$response = (new Test(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'xml']))
->run();
self::assertEquals(['Content-type' => ['text/xml'], ICanCreateResponses::X_HEADER => ['xml']], $response->getHeaders());
self::assertEquals([
'Content-type' => ['text/xml'],
ICanCreateResponses::X_HEADER => ['xml']
], $response->getHeaders());
self::assertxml($response->getBody(), 'ok');
}
}