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:
Koji Tanaka 2023-01-08 10:33:58 +09:00 committed by Kamil Wylegala
parent 5ae08a4dba
commit 831bfe9315

View file

@ -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']);