changing Shell to use ConsoleLog

This commit is contained in:
Rachman Chavik 2012-05-09 12:03:51 +07:00
parent d10727797b
commit bb090c54cf
2 changed files with 15 additions and 0 deletions

View file

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

View file

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