[Console] OutputFormatter Unset Bold has wrong id

This commit is contained in:
Denis Zunke 2014-06-03 10:49:52 +02:00 committed by Fabien Potencier
parent 315c3e50d8
commit 724bb50942
2 changed files with 7 additions and 7 deletions

View File

@ -41,7 +41,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface
'white' => array('set' => 47, 'unset' => 49)
);
private static $availableOptions = array(
'bold' => array('set' => 1, 'unset' => 21),
'bold' => array('set' => 1, 'unset' => 22),
'underscore' => array('set' => 4, 'unset' => 24),
'blink' => array('set' => 5, 'unset' => 25),
'reverse' => array('set' => 7, 'unset' => 27),
@ -202,7 +202,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface
public function apply($text)
{
$setCodes = array();
$unsetCode = array();
$unsetCodes = array();
if (null !== $this->foreground) {
$setCodes[] = $this->foreground['set'];

View File

@ -18,7 +18,7 @@ class OutputFormatterStyleTest extends \PHPUnit_Framework_TestCase
public function testConstructor()
{
$style = new OutputFormatterStyle('green', 'black', array('bold', 'underscore'));
$this->assertEquals("\033[32;40;1;4mfoo\033[39;49;21;24m", $style->apply('foo'));
$this->assertEquals("\033[32;40;1;4mfoo\033[39;49;22;24m", $style->apply('foo'));
$style = new OutputFormatterStyle('red', null, array('blink'));
$this->assertEquals("\033[31;5mfoo\033[39;25m", $style->apply('foo'));
@ -63,16 +63,16 @@ class OutputFormatterStyleTest extends \PHPUnit_Framework_TestCase
$this->assertEquals("\033[7;8mfoo\033[27;28m", $style->apply('foo'));
$style->setOption('bold');
$this->assertEquals("\033[7;8;1mfoo\033[27;28;21m", $style->apply('foo'));
$this->assertEquals("\033[7;8;1mfoo\033[27;28;22m", $style->apply('foo'));
$style->unsetOption('reverse');
$this->assertEquals("\033[8;1mfoo\033[28;21m", $style->apply('foo'));
$this->assertEquals("\033[8;1mfoo\033[28;22m", $style->apply('foo'));
$style->setOption('bold');
$this->assertEquals("\033[8;1mfoo\033[28;21m", $style->apply('foo'));
$this->assertEquals("\033[8;1mfoo\033[28;22m", $style->apply('foo'));
$style->setOptions(array('bold'));
$this->assertEquals("\033[1mfoo\033[21m", $style->apply('foo'));
$this->assertEquals("\033[1mfoo\033[22m", $style->apply('foo'));
try {
$style->setOption('foo');