mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Assert CakeException throw when json_encode fails
This commit is contained in:
parent
8e735c2db0
commit
05aba7afb6
1 changed files with 21 additions and 0 deletions
|
@ -306,4 +306,25 @@ class JsonViewTest extends CakeTestCase {
|
|||
$this->assertSame($expected, $output);
|
||||
$this->assertSame('application/javascript', $Response->type());
|
||||
}
|
||||
|
||||
/**
|
||||
* JsonViewTest::testRenderInvalidJSON()
|
||||
*
|
||||
* @expectedException CakeException
|
||||
* @return void
|
||||
*/
|
||||
public function testRenderInvalidJSON() {
|
||||
$Request = new CakeRequest();
|
||||
$Response = new CakeResponse();
|
||||
$Controller = new Controller($Request, $Response);
|
||||
|
||||
// non utf-8 stuff
|
||||
$data = array('data' => array('foo' => 'bar' . chr('0x97')));
|
||||
|
||||
$Controller->set($data);
|
||||
$Controller->set('_serialize', 'data');
|
||||
$View = new JsonView($Controller);
|
||||
$output = $View->render();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue