Making ConsoleOutput work correctly when multiple identical tags are used.

This commit is contained in:
mark_story 2010-10-14 22:16:42 -04:00
parent 0428320c78
commit b8467164f8
2 changed files with 5 additions and 2 deletions

View file

@ -163,7 +163,7 @@ class ConsoleOutput {
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
);
}

View file

@ -194,7 +194,10 @@ class ConsoleOutputTest extends CakeTestCase {
* @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);
}
/**