Skip to content

Commit

Permalink
Making ConsoleOutput work correctly when multiple identical tags are …
Browse files Browse the repository at this point in the history
…used.
  • Loading branch information
markstory committed Oct 15, 2010
1 parent 0428320 commit b846716
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cake/console/console_output.php
Expand Up @@ -163,7 +163,7 @@ public function styleText($text) {
return strip_tags($text);
}
return preg_replace_callback(
'/<(?<tag>[a-z0-9-_]+)>(?<text>.*)<\/(\1)>/i', array($this, '_replaceTags'), $text
'/<(?<tag>[a-z0-9-_]+)>(?<text>.*?)<\/(\1)>/i', array($this, '_replaceTags'), $text
);
}

Expand Down
5 changes: 4 additions & 1 deletion cake/tests/cases/console/console_output.test.php
Expand Up @@ -194,7 +194,10 @@ function testFormattingMultipleStylesName() {
* @return void
*/
function testFormattingMultipleSameTags() {
$this->markTestIncomplete('This test needs to be written.');
$this->output->expects($this->once())->method('_write')
->with("\033[31;4mBad\033[0m \033[31;4mWarning\033[0m Regular");

$this->output->write('<error>Bad</error> <error>Warning</error> Regular', false);
}

/**
Expand Down

0 comments on commit b846716

Please sign in to comment.