mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +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 {
|
||||
|
||||
/**
|
||||
* setUp method
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
Configure::write('debug', 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
public function tearDown() {
|
||||
parent::tearDown();
|
||||
restore_error_handler();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates testRenderWithoutView data.
|
||||
*
|
||||
|
@ -324,7 +339,7 @@ class JsonViewTest extends CakeTestCase {
|
|||
/**
|
||||
* JsonViewTest::testRenderInvalidJSON()
|
||||
*
|
||||
* expectedException CakeException
|
||||
* @expectedException CakeException
|
||||
* @return void
|
||||
*/
|
||||
public function testRenderInvalidJSON() {
|
||||
|
@ -336,7 +351,7 @@ class JsonViewTest extends CakeTestCase {
|
|||
$data = array('data' => array('foo' => 'bar' . chr('0x97')));
|
||||
|
||||
// Use a custom error handler
|
||||
$phpUnitErrorHandler = set_error_handler(array($this, 'jsonEncodeErrorHandler'));
|
||||
set_error_handler(array($this, 'jsonEncodeErrorHandler'));
|
||||
|
||||
$Controller->set($data);
|
||||
$Controller->set('_serialize', 'data');
|
||||
|
|
Loading…
Add table
Reference in a new issue