mirror of
https://github.com/friendica/friendica
synced 2025-04-29 19:44:22 +02:00
Simplify json testing
This commit is contained in:
parent
6a813eec92
commit
354c2d828a
17 changed files with 45 additions and 66 deletions
|
@ -15,7 +15,7 @@ class RateLimitStatusTest extends ApiTest
|
|||
$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();
|
||||
|
||||
$result = json_decode($response->getBody());
|
||||
$result = $this->toJson($response);
|
||||
|
||||
self::assertEquals(['Content-type' => ['application/json'], ICanCreateResponses::X_HEADER => ['json']], $response->getHeaders());
|
||||
self::assertEquals(150, $result->remaining_hits);
|
||||
|
|
|
@ -17,11 +17,7 @@ class UpdateProfileTest extends ApiTest
|
|||
$updateProfile = new UpdateProfile(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST], ['extension' => 'json']);
|
||||
$response = $updateProfile->run(['name' => 'new_name', 'description' => 'new_description']);
|
||||
|
||||
$body = (string)$response->getBody();
|
||||
|
||||
self::assertJson($body);
|
||||
|
||||
$json = json_decode($body);
|
||||
$json = $this->toJson($response);
|
||||
|
||||
self::assertEquals('new_name', $json->name);
|
||||
self::assertEquals('new_description', $json->description);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue