Navigation Menu

Skip to content

Commit

Permalink
Assert exception is thrown, reset error handler in tearDown
Browse files Browse the repository at this point in the history
  • Loading branch information
robmcvey committed Mar 14, 2015
1 parent 56c6f02 commit fe0ddf2
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions lib/Cake/Test/Case/View/JsonViewTest.php
Expand Up @@ -28,11 +28,26 @@
*/
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.
*
Expand Down Expand Up @@ -324,7 +339,7 @@ public function testRenderWithViewAndNamed() {
/**
* JsonViewTest::testRenderInvalidJSON()
*
* expectedException CakeException
* @expectedException CakeException
* @return void
*/
public function testRenderInvalidJSON() {
Expand All @@ -336,7 +351,7 @@ public function testRenderInvalidJSON() {
$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');
Expand Down

0 comments on commit fe0ddf2

Please sign in to comment.