Skip to content
Permalink
Browse files

Fixing issues with background colours, and adding tests for options.

  • Loading branch information...
markstory committed Oct 3, 2010
1 parent d5b5fbe commit 90d5c12b3e6a91544bcf82cc43331160218b41fc
Showing with 22 additions and 3 deletions.
  1. +3 −3 cake/console/console_output.php
  2. +19 −0 cake/tests/cases/console/console_output.test.php
@@ -94,7 +94,7 @@ class ConsoleOutput {
*/
protected static $_options = array(
'bold' => 1,
'underscore' => 4,
'underline' => 4,
'blink' => 5,
'reverse' => 7,
'conceal' => 8
@@ -164,8 +164,8 @@ protected function _replaceTags($matches) {
if (!empty($style['text']) && isset(self::$_foregroundColors[$style['text']])) {
$styleInfo[] = self::$_foregroundColors[$style['text']];
}
if (!empty($style['background']) && isset(self::$_foregroundColors[$style['background']])) {
$styleInfo[] = self::$_foregroundColors[$style['background']];
if (!empty($style['background']) && isset(self::$_backgroundColors[$style['background']])) {
$styleInfo[] = self::$_backgroundColors[$style['background']];
}
unset($style['text'], $style['background']);
foreach ($style as $option => $value) {
@@ -133,6 +133,25 @@ function testFormattingSimple() {
$this->output->write('<error>Error:</error> Something bad', false);
}
/**
* test formatting with custom styles.
*
* @return void
*/
function testFormattingCustom() {
$this->output->styles('annoying', array(
'text' => 'magenta',
'background' => 'cyan',
'blink' => true,
'underline' => true
));
$this->output->expects($this->once())->method('_write')
->with("\033[35;46;5;4mAnnoy:\033[0m Something bad");
$this->output->write('<annoying>Annoy:</annoying> Something bad', false);
}
/**
* test formatting text with missing styles.
*

0 comments on commit 90d5c12

Please sign in to comment.
You can’t perform that action at this time.