mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fixed tests
This commit is contained in:
parent
e5134986e6
commit
a5e1be7abf
1 changed files with 24 additions and 4 deletions
|
@ -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');
|
||||||
ErrorHandler::handleFatalError(E_USER_ERROR, 'Initial error', __FILE__, __LINE__);
|
|
||||||
|
$result = false;
|
||||||
|
try {
|
||||||
|
ob_start();
|
||||||
|
ob_start();
|
||||||
|
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');
|
||||||
ErrorHandler::handleFatalError(E_USER_ERROR, 'Initial error', __FILE__, __LINE__);
|
|
||||||
|
$result = false;
|
||||||
|
try {
|
||||||
|
ob_start();
|
||||||
|
ob_start();
|
||||||
|
ErrorHandler::handleFatalError(E_USER_ERROR, 'Initial error', __FILE__, __LINE__);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$result = $e instanceof InternalErrorException;
|
||||||
|
}
|
||||||
|
|
||||||
|
restore_error_handler();
|
||||||
|
$this->assertTrue($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue