Browse Source

Wrappers for quiet() and verbose()

Mark Scherer 10 years ago
parent
commit
072c0ce4cb
2 changed files with 52 additions and 0 deletions
  1. 24 0
      src/Console/Shell.php
  2. 28 0
      tests/TestCase/Console/ShellTest.php

+ 24 - 0
src/Console/Shell.php

@@ -503,6 +503,30 @@ class Shell
     }
 
     /**
+     * Output at the verbose level.
+     *
+     * @param string|array $message A string or an array of strings to output
+     * @param int $newlines Number of newlines to append
+     * @return int|bool Returns the number of bytes returned from writing to stdout.
+     */
+    public function verbose($message, $newlines = 1)
+    {
+        return $this->io->verbose($message, $newlines);
+    }
+
+    /**
+     * Output at all levels.
+     *
+     * @param string|array $message A string or an array of strings to output
+     * @param int $newlines Number of newlines to append
+     * @return int|bool Returns the number of bytes returned from writing to stdout.
+     */
+    public function quiet($message, $newlines = 1)
+    {
+        return $this->io->quiet($message, $newlines);
+    }
+
+    /**
      * Outputs a single or multiple messages to stdout. If no parameters
      * are passed outputs just a newline.
      *

+ 28 - 0
tests/TestCase/Console/ShellTest.php

@@ -264,6 +264,34 @@ class ShellTest extends TestCase
     }
 
     /**
+     * testVerbose method
+     *
+     * @return void
+     */
+    public function testVerbose()
+    {
+        $this->io->expects($this->once())
+            ->method('verbose')
+            ->with('Just a test', 1);
+
+        $this->Shell->verbose('Just a test');
+    }
+
+    /**
+     * testQuiet method
+     *
+     * @return void
+     */
+    public function testQuiet()
+    {
+        $this->io->expects($this->once())
+            ->method('quiet')
+            ->with('Just a test', 1);
+
+        $this->Shell->quiet('Just a test');
+    }
+
+    /**
      * testOut method
      *
      * @return void