mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
changing Shell to use ConsoleLog
This commit is contained in:
parent
d10727797b
commit
bb090c54cf
2 changed files with 15 additions and 0 deletions
|
@ -165,9 +165,19 @@ class Shell extends Object {
|
|||
if ($this->stdout == null) {
|
||||
$this->stdout = new ConsoleOutput('php://stdout');
|
||||
}
|
||||
CakeLog::config('stdout', array(
|
||||
'engine' => 'ConsoleLog',
|
||||
'types' => array('notice', 'info'),
|
||||
'stream' => $this->stdout,
|
||||
));
|
||||
if ($this->stderr == null) {
|
||||
$this->stderr = new ConsoleOutput('php://stderr');
|
||||
}
|
||||
CakeLog::config('stderr', array(
|
||||
'engine' => 'ConsoleLog',
|
||||
'types' => array('error', 'warning'),
|
||||
'stream' => $this->stderr,
|
||||
));
|
||||
if ($this->stdin == null) {
|
||||
$this->stdin = new ConsoleInput('php://stdin');
|
||||
}
|
||||
|
|
|
@ -596,9 +596,14 @@ class BasicsTest extends CakeTestCase {
|
|||
public function testLogError() {
|
||||
@unlink(LOGS . 'error.log');
|
||||
|
||||
// disable stderr output for this test
|
||||
CakeLog::disable('stderr');
|
||||
|
||||
LogError('Testing LogError() basic function');
|
||||
LogError("Testing with\nmulti-line\nstring");
|
||||
|
||||
CakeLog::enable('stderr');
|
||||
|
||||
$result = file_get_contents(LOGS . 'error.log');
|
||||
$this->assertRegExp('/Error: Testing LogError\(\) basic function/', $result);
|
||||
$this->assertNotRegExp("/Error: Testing with\nmulti-line\nstring/", $result);
|
||||
|
|
Loading…
Reference in a new issue