mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-25 08:17:18 +00:00
test: In ConfigureTest::testBootstrap(), set error handler, so add cleanup.
This is because PHPUnit error handlers cannot catch PHP errors in tests that run after DebuggerTest if they expect them to occur and break the test process.
This commit is contained in:
parent
5ae08a4dba
commit
831bfe9315
1 changed files with 7 additions and 0 deletions
|
@ -27,6 +27,8 @@ App::uses('PhpReader', 'Configure');
|
|||
*/
|
||||
class ConfigureTest extends CakeTestCase {
|
||||
|
||||
protected $_restoreError = false;
|
||||
|
||||
/**
|
||||
* setUp method
|
||||
*
|
||||
|
@ -65,6 +67,10 @@ class ConfigureTest extends CakeTestCase {
|
|||
unlink(TMP . 'cache' . DS . 'persistent' . DS . 'test.php');
|
||||
}
|
||||
Configure::drop('test');
|
||||
|
||||
if ($this->_restoreError) {
|
||||
restore_error_handler();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -79,6 +85,7 @@ class ConfigureTest extends CakeTestCase {
|
|||
Configure::write('App', $expected);
|
||||
|
||||
Configure::bootstrap(true);
|
||||
$this->_restoreError = true;
|
||||
$result = Configure::read('App');
|
||||
|
||||
$this->assertEquals($expected['foo'], $result['foo']);
|
||||
|
|
Loading…
Reference in a new issue