test: Allow ErrorHandlerTest to run even if CakeLog configs (stdout and stderr) are not configured.

When ErrorHandlerTest is run with CakeTestRunner (TestShell) (or run with ShellTest, etc.), these configs are provided in the initialization process of the Shell class, but are not needed in many test cases.
This commit is contained in:
Koji Tanaka 2023-01-07 15:35:03 +09:00 committed by Kamil Wylegala
parent b46b6c758f
commit 76d1673958

View file

@ -66,9 +66,13 @@ class ErrorHandlerTest extends CakeTestCase {
Router::setRequestInfo($request);
Configure::write('debug', 2);
if (CakeLog::stream('stdout') !== false) {
CakeLog::disable('stdout');
}
if (CakeLog::stream('stderr') !== false) {
CakeLog::disable('stderr');
}
}
/**
* tearDown
@ -80,9 +84,14 @@ class ErrorHandlerTest extends CakeTestCase {
if ($this->_restoreError) {
restore_error_handler();
}
if (CakeLog::stream('stdout') !== false) {
CakeLog::enable('stdout');
}
if (CakeLog::stream('stderr') !== false) {
CakeLog::enable('stderr');
}
}
/**
* test error handling when debug is on, an error should be printed from Debugger.