Fixed tests

This commit is contained in:
David Steinsland 2015-01-15 23:11:36 +01:00
parent e5134986e6
commit a5e1be7abf

View file

@ -340,25 +340,45 @@ class ErrorHandlerTest extends CakeTestCase {
/** /**
* testExceptionRendererNestingDebug method * testExceptionRendererNestingDebug method
* *
* @expectedException FatalErrorException
* @return void * @return void
*/ */
public function testExceptionRendererNestingDebug() { public function testExceptionRendererNestingDebug() {
Configure::write('debug', 2); Configure::write('debug', 2);
Configure::write('Exception.renderer', 'FaultyExceptionRenderer'); Configure::write('Exception.renderer', 'FaultyExceptionRenderer');
$result = false;
try {
ob_start();
ob_start();
ErrorHandler::handleFatalError(E_USER_ERROR, 'Initial error', __FILE__, __LINE__); ErrorHandler::handleFatalError(E_USER_ERROR, 'Initial error', __FILE__, __LINE__);
} catch (Exception $e) {
$result = $e instanceof FatalErrorException;
}
restore_error_handler();
$this->assertTrue($result);
} }
/** /**
* testExceptionRendererNestingProduction method * testExceptionRendererNestingProduction method
* *
* @expectedException InternalErrorException
* @return void * @return void
*/ */
public function testExceptionRendererNestingProduction() { public function testExceptionRendererNestingProduction() {
Configure::write('debug', 0); Configure::write('debug', 0);
Configure::write('Exception.renderer', 'FaultyExceptionRenderer'); Configure::write('Exception.renderer', 'FaultyExceptionRenderer');
$result = false;
try {
ob_start();
ob_start();
ErrorHandler::handleFatalError(E_USER_ERROR, 'Initial error', __FILE__, __LINE__); ErrorHandler::handleFatalError(E_USER_ERROR, 'Initial error', __FILE__, __LINE__);
} catch (Exception $e) {
$result = $e instanceof InternalErrorException;
}
restore_error_handler();
$this->assertTrue($result);
} }
} }