mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Making error output style have an underline.
Adding a comment style which has blue text.
This commit is contained in:
parent
f5ad54e97e
commit
a3259743f7
2 changed files with 10 additions and 8 deletions
|
@ -24,9 +24,10 @@
|
|||
* Can generate colourzied output on consoles that support it. There are a few
|
||||
* built in styles
|
||||
*
|
||||
* - `error` Error messages. Bright red text.
|
||||
* - `warning` Warning messages. Bright orange text
|
||||
* - `info` Informational messages. Cyan text.
|
||||
* - `error` Error messages.
|
||||
* - `warning` Warning messages.
|
||||
* - `info` Informational messages.
|
||||
* - `comment` Additional text.
|
||||
*
|
||||
* By defining styles with addStyle() you can create custom console styles.
|
||||
*
|
||||
|
@ -113,10 +114,11 @@ class ConsoleOutput {
|
|||
* @var array
|
||||
*/
|
||||
protected static $_styles = array(
|
||||
'error' => array('text' => 'red'),
|
||||
'error' => array('text' => 'red', 'underline' => true),
|
||||
'warning' => array('text' => 'yellow'),
|
||||
'info' => array('text' => 'cyan'),
|
||||
'success' => array('text' => 'green')
|
||||
'success' => array('text' => 'green'),
|
||||
'comment' => array('text' => 'blue')
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
|
@ -96,7 +96,7 @@ class ConsoleOutputTest extends CakeTestCase {
|
|||
*/
|
||||
function testStylesGet() {
|
||||
$result = $this->output->styles('error');
|
||||
$expected = array('text' => 'red');
|
||||
$expected = array('text' => 'red', 'underline' => true);
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$this->assertNull($this->output->styles('made_up_goop'));
|
||||
|
@ -128,7 +128,7 @@ class ConsoleOutputTest extends CakeTestCase {
|
|||
*/
|
||||
function testFormattingSimple() {
|
||||
$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);
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ class ConsoleOutputTest extends CakeTestCase {
|
|||
*/
|
||||
function testFormattingMultipleStylesName() {
|
||||
$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);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue