mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
Fixing issues with background colours, and adding tests for options.
This commit is contained in:
parent
d5b5fbee3b
commit
90d5c12b3e
2 changed files with 22 additions and 3 deletions
|
@ -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) {
|
||||
|
|
|
@ -133,6 +133,25 @@ class ConsoleOutputTest extends CakeTestCase {
|
|||
$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.
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue