Making error output style have an underline.

Adding a comment style which has blue text.
This commit is contained in:
mark_story 2010-10-09 11:01:22 -04:00
parent f5ad54e97e
commit a3259743f7
2 changed files with 10 additions and 8 deletions

View file

@ -24,9 +24,10 @@
* Can generate colourzied output on consoles that support it. There are a few * Can generate colourzied output on consoles that support it. There are a few
* built in styles * built in styles
* *
* - `error` Error messages. Bright red text. * - `error` Error messages.
* - `warning` Warning messages. Bright orange text * - `warning` Warning messages.
* - `info` Informational messages. Cyan text. * - `info` Informational messages.
* - `comment` Additional text.
* *
* By defining styles with addStyle() you can create custom console styles. * By defining styles with addStyle() you can create custom console styles.
* *
@ -113,10 +114,11 @@ class ConsoleOutput {
* @var array * @var array
*/ */
protected static $_styles = array( protected static $_styles = array(
'error' => array('text' => 'red'), 'error' => array('text' => 'red', 'underline' => true),
'warning' => array('text' => 'yellow'), 'warning' => array('text' => 'yellow'),
'info' => array('text' => 'cyan'), 'info' => array('text' => 'cyan'),
'success' => array('text' => 'green') 'success' => array('text' => 'green'),
'comment' => array('text' => 'blue')
); );
/** /**

View file

@ -96,7 +96,7 @@ class ConsoleOutputTest extends CakeTestCase {
*/ */
function testStylesGet() { function testStylesGet() {
$result = $this->output->styles('error'); $result = $this->output->styles('error');
$expected = array('text' => 'red'); $expected = array('text' => 'red', 'underline' => true);
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
$this->assertNull($this->output->styles('made_up_goop')); $this->assertNull($this->output->styles('made_up_goop'));
@ -128,7 +128,7 @@ class ConsoleOutputTest extends CakeTestCase {
*/ */
function testFormattingSimple() { function testFormattingSimple() {
$this->output->expects($this->once())->method('_write') $this->output->expects($this->once())->method('_write')
->with("\033[31mError:\033[0m Something bad"); ->with("\033[31;4mError:\033[0m Something bad");
$this->output->write('<error>Error:</error> Something bad', false); $this->output->write('<error>Error:</error> Something bad', false);
} }
@ -171,7 +171,7 @@ class ConsoleOutputTest extends CakeTestCase {
*/ */
function testFormattingMultipleStylesName() { function testFormattingMultipleStylesName() {
$this->output->expects($this->once())->method('_write') $this->output->expects($this->once())->method('_write')
->with("\033[31mBad\033[0m \033[33mWarning\033[0m Regular"); ->with("\033[31;4mBad\033[0m \033[33mWarning\033[0m Regular");
$this->output->write('<error>Bad</error> <warning>Warning</warning> Regular', false); $this->output->write('<error>Bad</error> <warning>Warning</warning> Regular', false);
} }