mirror of
https://github.com/friendica/friendica
synced 2025-04-24 08:30:11 +00:00
Add feedback - avoid intermediate variables
This commit is contained in:
parent
adf0d7bc95
commit
301ac83ebf
42 changed files with 367 additions and 272 deletions
|
@ -12,12 +12,15 @@ class RateLimitStatusTest extends ApiTest
|
|||
{
|
||||
public function testWithJson()
|
||||
{
|
||||
$rateLimitStatus = new RateLimitStatus(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => 'json']);
|
||||
$response = $rateLimitStatus->run();
|
||||
$response = (new RateLimitStatus(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => 'json']))
|
||||
->run();
|
||||
|
||||
$result = $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(150, $result->remaining_hits);
|
||||
self::assertEquals(150, $result->hourly_limit);
|
||||
self::assertIsInt($result->reset_time_in_seconds);
|
||||
|
@ -25,10 +28,13 @@ class RateLimitStatusTest extends ApiTest
|
|||
|
||||
public function testWithXml()
|
||||
{
|
||||
$rateLimitStatus = new RateLimitStatus(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'xml']);
|
||||
$response = $rateLimitStatus->run();
|
||||
$response = (new RateLimitStatus(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(), 'hash');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue