mirror of
https://github.com/nextcloud/passman.git
synced 2025-02-26 00:14:44 +08:00
NotFoundJSONResponse unit tests
This commit is contained in:
parent
1e8d742c01
commit
e2faab8f4d
1 changed files with 29 additions and 0 deletions
29
tests/unit/lib/Utility/NotFoundJSONResponseTest.php
Normal file
29
tests/unit/lib/Utility/NotFoundJSONResponseTest.php
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Test case for the NotFoundJSONResponse class
|
||||
* Date: 8/10/16
|
||||
* Time: 18:34
|
||||
* @copyright Marcos Zuriaga Miguel 2016
|
||||
* @license AGPLv3
|
||||
*/
|
||||
use \OCA\Passman\Utility\NotFoundJSONResponse;
|
||||
use \OCP\AppFramework\Http;
|
||||
class NotFoundJSONResponseTest extends PHPUnit_Framework_TestCase {
|
||||
public function testOnEmptyResponse(){
|
||||
$data = new NotFoundJSONResponse();
|
||||
$this->assertTrue($data->getStatus() === Http::STATUS_NOT_FOUND);
|
||||
$this->assertJsonStringEqualsJsonString('[]', $data->render(), 'Expected empty JSON response');
|
||||
}
|
||||
|
||||
public function testOnDataResult(){
|
||||
$data = [
|
||||
'field' => 'value',
|
||||
'boolean' => true,
|
||||
'integer' => 21
|
||||
];
|
||||
$response = new NotFoundJSONResponse($data);
|
||||
$this->assertTrue($response->getStatus() === Http::STATUS_NOT_FOUND);
|
||||
$this->assertJsonStringEqualsJsonString(json_encode($data), $response->render(), 'Rendered data does not match with expected data');
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue