From bb090c54cf31cd6ff42d127b705d440191b9946a Mon Sep 17 00:00:00 2001 From: Rachman Chavik Date: Wed, 9 May 2012 12:03:51 +0700 Subject: [PATCH] changing Shell to use ConsoleLog --- lib/Cake/Console/Shell.php | 10 ++++++++++ lib/Cake/Test/Case/BasicsTest.php | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/lib/Cake/Console/Shell.php b/lib/Cake/Console/Shell.php index 788bb8b39..a16dafe0d 100644 --- a/lib/Cake/Console/Shell.php +++ b/lib/Cake/Console/Shell.php @@ -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'); } diff --git a/lib/Cake/Test/Case/BasicsTest.php b/lib/Cake/Test/Case/BasicsTest.php index cd00c1f43..9e4404374 100644 --- a/lib/Cake/Test/Case/BasicsTest.php +++ b/lib/Cake/Test/Case/BasicsTest.php @@ -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);