Permalink
Browse files

changing Shell to use ConsoleLog

  • Loading branch information...
1 parent d107277 commit bb090c54cf31cd6ff42d127b705d440191b9946a @rchavik rchavik committed May 9, 2012
Showing with 15 additions and 0 deletions.
  1. +10 −0 lib/Cake/Console/Shell.php
  2. +5 −0 lib/Cake/Test/Case/BasicsTest.php
View
@@ -165,9 +165,19 @@ public function __construct($stdout = null, $stderr = null, $stdin = null) {
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 @@ public function testTranslateDomainCategoryPlural() {
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);

0 comments on commit bb090c5

Please sign in to comment.