Skip to content

Commit

Permalink
Wrappers for quiet() and verbose()
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Scherer committed Aug 25, 2015
1 parent 683e3ad commit 072c0ce
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/Console/Shell.php
Expand Up @@ -502,6 +502,30 @@ public function wrapText($text, $options = [])
return Text::wrap($text, $options);
}

/**
* 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.
Expand Down
28 changes: 28 additions & 0 deletions tests/TestCase/Console/ShellTest.php
Expand Up @@ -263,6 +263,34 @@ public function testInNonInteractive()
$this->assertEquals('n', $result);
}

/**
* 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
*
Expand Down

0 comments on commit 072c0ce

Please sign in to comment.