diff --git a/cake/console/console_output.php b/cake/console/console_output.php
index 5df2f7820..424df97cd 100644
--- a/cake/console/console_output.php
+++ b/cake/console/console_output.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 @@ class ConsoleOutput {
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) {
diff --git a/cake/tests/cases/console/console_output.test.php b/cake/tests/cases/console/console_output.test.php
index da060267e..7509dfbe0 100644
--- a/cake/tests/cases/console/console_output.test.php
+++ b/cake/tests/cases/console/console_output.test.php
@@ -133,6 +133,25 @@ class ConsoleOutputTest extends CakeTestCase {
$this->output->write('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('Annoy: Something bad', false);
+ }
+
/**
* test formatting text with missing styles.
*