[Console] Fixed output formatter test broken by new implementation.
This commit is contained in:
parent
a1add4b8d5
commit
bd7e01a858
@ -12,6 +12,7 @@
|
||||
namespace Symfony\Tests\Component\Console\Formatter;
|
||||
|
||||
use Symfony\Component\Console\Formatter\OutputFormatter;
|
||||
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
|
||||
|
||||
class FormatterStyleTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
@ -51,36 +52,23 @@ class FormatterStyleTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$formatter = new OutputFormatter(true);
|
||||
|
||||
$style = $this->getMockBuilder('Symfony\Component\Console\Formatter\OutputFormatterStyleInterface')->getMock();
|
||||
$style = new OutputFormatterStyle('red', 'blue');
|
||||
$formatter->setStyle('test', $style);
|
||||
|
||||
$this->assertEquals($style, $formatter->getStyle('test'));
|
||||
$this->assertNotEquals($style, $formatter->getStyle('info'));
|
||||
|
||||
$style
|
||||
->expects($this->once())
|
||||
->method('apply')
|
||||
->will($this->returnValue('[STYLE_BEG]some custom msg[STYLE_END]'));
|
||||
|
||||
$this->assertEquals("[STYLE_BEG]some custom msg[STYLE_END]", $formatter->format('<test>some custom msg</test>'));
|
||||
$this->assertEquals("\033[31;44msome custom msg\033[0m", $formatter->format('<test>some custom msg</test>'));
|
||||
}
|
||||
|
||||
public function testRedefineStyle()
|
||||
{
|
||||
$formatter = new OutputFormatter(true);
|
||||
|
||||
$style = $this->getMockBuilder('Symfony\Component\Console\Formatter\OutputFormatterStyleInterface')
|
||||
->getMock();
|
||||
$style = new OutputFormatterStyle('red', 'blue');
|
||||
$formatter->setStyle('info', $style);
|
||||
|
||||
$style
|
||||
->expects($this->once())
|
||||
->method('apply')
|
||||
->will($this->returnValue('[STYLE_BEG]some custom msg[STYLE_END]'));
|
||||
|
||||
$this->assertEquals(
|
||||
"[STYLE_BEG]some custom msg[STYLE_END]", $formatter->format('<info>some custom msg</info>')
|
||||
);
|
||||
$this->assertEquals("\033[31;44msome custom msg\033[0m", $formatter->format('<info>some custom msg</info>'));
|
||||
}
|
||||
|
||||
public function testInlineStyle()
|
||||
|
Reference in New Issue
Block a user