Skip to content

Commit

Permalink
[Console] OutputFormatter Unset Bold has wrong id
Browse files Browse the repository at this point in the history
  • Loading branch information
DZunke authored and fabpot committed Jun 3, 2014
1 parent 315c3e5 commit 724bb50
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Expand Up @@ -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),
Expand Down Expand Up @@ -202,7 +202,7 @@ public function setOptions(array $options)
public function apply($text)
{
$setCodes = array();
$unsetCode = array();
$unsetCodes = array();

if (null !== $this->foreground) {
$setCodes[] = $this->foreground['set'];
Expand Down
Expand Up @@ -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'));
Expand Down Expand Up @@ -63,16 +63,16 @@ public function testOptions()
$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');
Expand Down

0 comments on commit 724bb50

Please sign in to comment.