mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-02-07 12:36:25 +00:00
Assert exception is thrown, reset error handler in tearDown
This commit is contained in:
parent
56c6f02efc
commit
fe0ddf2171
1 changed files with 17 additions and 2 deletions
|
@ -28,11 +28,26 @@ App::uses('JsonView', 'View');
|
||||||
*/
|
*/
|
||||||
class JsonViewTest extends CakeTestCase {
|
class JsonViewTest extends CakeTestCase {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* setUp method
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
**/
|
||||||
public function setUp() {
|
public function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
Configure::write('debug', 0);
|
Configure::write('debug', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* tearDown method
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
**/
|
||||||
|
public function tearDown() {
|
||||||
|
parent::tearDown();
|
||||||
|
restore_error_handler();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates testRenderWithoutView data.
|
* Generates testRenderWithoutView data.
|
||||||
*
|
*
|
||||||
|
@ -324,7 +339,7 @@ class JsonViewTest extends CakeTestCase {
|
||||||
/**
|
/**
|
||||||
* JsonViewTest::testRenderInvalidJSON()
|
* JsonViewTest::testRenderInvalidJSON()
|
||||||
*
|
*
|
||||||
* expectedException CakeException
|
* @expectedException CakeException
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testRenderInvalidJSON() {
|
public function testRenderInvalidJSON() {
|
||||||
|
@ -336,7 +351,7 @@ class JsonViewTest extends CakeTestCase {
|
||||||
$data = array('data' => array('foo' => 'bar' . chr('0x97')));
|
$data = array('data' => array('foo' => 'bar' . chr('0x97')));
|
||||||
|
|
||||||
// Use a custom error handler
|
// Use a custom error handler
|
||||||
$phpUnitErrorHandler = set_error_handler(array($this, 'jsonEncodeErrorHandler'));
|
set_error_handler(array($this, 'jsonEncodeErrorHandler'));
|
||||||
|
|
||||||
$Controller->set($data);
|
$Controller->set($data);
|
||||||
$Controller->set('_serialize', 'data');
|
$Controller->set('_serialize', 'data');
|
||||||
|
|
Loading…
Add table
Reference in a new issue