Assert exception is thrown, reset error handler in tearDown

This commit is contained in:
Rob McVey 2015-03-14 13:27:34 +00:00
parent 56c6f02efc
commit fe0ddf2171

View file

@ -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');