From 831bfe9315c3093748b93add17403416c2618a5e Mon Sep 17 00:00:00 2001 From: Koji Tanaka Date: Sun, 8 Jan 2023 10:33:58 +0900 Subject: [PATCH] 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. --- lib/Cake/Test/Case/Core/ConfigureTest.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/Cake/Test/Case/Core/ConfigureTest.php b/lib/Cake/Test/Case/Core/ConfigureTest.php index 0cb7d1723..435cf4a05 100644 --- a/lib/Cake/Test/Case/Core/ConfigureTest.php +++ b/lib/Cake/Test/Case/Core/ConfigureTest.php @@ -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']);