Skip to content

Commit fe0ddf2

Browse files
committed
Assert exception is thrown, reset error handler in tearDown
1 parent 56c6f02 commit fe0ddf2

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

lib/Cake/Test/Case/View/JsonViewTest.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,26 @@
2828
*/
2929
class JsonViewTest extends CakeTestCase {
3030

31+
/**
32+
* setUp method
33+
*
34+
* @return void
35+
**/
3136
public function setUp() {
3237
parent::setUp();
3338
Configure::write('debug', 0);
3439
}
3540

41+
/**
42+
* tearDown method
43+
*
44+
* @return void
45+
**/
46+
public function tearDown() {
47+
parent::tearDown();
48+
restore_error_handler();
49+
}
50+
3651
/**
3752
* Generates testRenderWithoutView data.
3853
*
@@ -324,7 +339,7 @@ public function testRenderWithViewAndNamed() {
324339
/**
325340
* JsonViewTest::testRenderInvalidJSON()
326341
*
327-
* expectedException CakeException
342+
* @expectedException CakeException
328343
* @return void
329344
*/
330345
public function testRenderInvalidJSON() {
@@ -336,7 +351,7 @@ public function testRenderInvalidJSON() {
336351
$data = array('data' => array('foo' => 'bar' . chr('0x97')));
337352

338353
// Use a custom error handler
339-
$phpUnitErrorHandler = set_error_handler(array($this, 'jsonEncodeErrorHandler'));
354+
set_error_handler(array($this, 'jsonEncodeErrorHandler'));
340355

341356
$Controller->set($data);
342357
$Controller->set('_serialize', 'data');

0 commit comments

Comments
 (0)