mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-12 01:54:26 +02:00
Simplify json testing
This commit is contained in:
parent
6a813eec92
commit
354c2d828a
17 changed files with 45 additions and 66 deletions
|
@ -78,7 +78,8 @@ XML;
|
|||
$notification = new Notification(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), [], ['extension' => 'json']);
|
||||
$response = $notification->run();
|
||||
|
||||
self::assertJson($response->getBody());
|
||||
$this->toJson($response);
|
||||
|
||||
self::assertEquals(['Content-type' => ['application/json'], ICanCreateResponses::X_HEADER => ['json']], $response->getHeaders());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,11 +53,7 @@ class DeleteTest extends ApiTest
|
|||
$delete = new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]);
|
||||
$response = $delete->run(['photo_id' => '709057080661a283a6aa598501504178']);
|
||||
|
||||
$responseText = (string)$response->getBody();
|
||||
|
||||
self::assertJson($responseText);
|
||||
|
||||
$json = json_decode($responseText);
|
||||
$json = $this->toJson($response);
|
||||
|
||||
self::assertEquals('deleted', $json->result);
|
||||
self::assertEquals('photo with id `709057080661a283a6aa598501504178` has been deleted from server.', $json->message);
|
||||
|
|
|
@ -49,11 +49,7 @@ class DeleteTest extends ApiTest
|
|||
$delete = new Delete(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]);
|
||||
$response = $delete->run(['album' => 'test_album']);
|
||||
|
||||
$responseText = (string)$response->getBody();
|
||||
|
||||
self::assertJson($responseText);
|
||||
|
||||
$json = json_decode($responseText);
|
||||
$json = $this->toJson($response);
|
||||
|
||||
self::assertEquals('deleted', $json->result);
|
||||
self::assertEquals('album `test_album` with all containing photos has been deleted.', $json->message);
|
||||
|
|
|
@ -58,11 +58,7 @@ class UpdateTest extends ApiTest
|
|||
|
||||
$response = (new Update(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::POST]))->run(['album' => 'test_album', 'album_new' => 'test_album_2']);
|
||||
|
||||
$responseBody = (string)$response->getBody();
|
||||
|
||||
self::assertJson($responseBody);
|
||||
|
||||
$json = json_decode($responseBody);
|
||||
$json = $this->toJson($response);
|
||||
|
||||
self::assertEquals('updated', $json->result);
|
||||
self::assertEquals('album `test_album` with all containing photos has been renamed to `test_album_2`.', $json->message);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue