Browse Source

Merge pull request #8811 from cakephp/fix-err-console

Fix err() to highlight error as red similar to warn() which is yellow.
Mark Story 10 years ago
parent
commit
27c3a0dc7d
2 changed files with 4 additions and 4 deletions
  1. 3 3
      src/Console/Shell.php
  2. 1 1
      tests/TestCase/Console/ShellTest.php

+ 3 - 3
src/Console/Shell.php

@@ -640,11 +640,11 @@ class Shell
      *
      * @param string|array|null $message A string or an array of strings to output
      * @param int $newlines Number of newlines to append
-     * @return void
+     * @return int|bool Returns the number of bytes returned from writing to stderr.
      */
     public function err($message = null, $newlines = 1)
     {
-        $this->_io->err($message, $newlines);
+        return $this->_io->err('<error>' . $message . '</error>', $newlines);
     }
 
     /**
@@ -671,7 +671,7 @@ class Shell
      */
     public function warn($message = null, $newlines = 1)
     {
-        return $this->err('<warning>' . $message . '</warning>', $newlines);
+        return $this->_io->err('<warning>' . $message . '</warning>', $newlines);
     }
 
     /**

+ 1 - 1
tests/TestCase/Console/ShellTest.php

@@ -307,7 +307,7 @@ class ShellTest extends TestCase
     {
         $this->io->expects($this->once())
             ->method('err')
-            ->with('Just a test', 1);
+            ->with('<error>Just a test</error>', 1);
 
         $this->Shell->err('Just a test');
     }