public function OutputFormatterStyleTest::testOptions in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/console/Tests/Formatter/OutputFormatterStyleTest.php \Symfony\Component\Console\Tests\Formatter\OutputFormatterStyleTest::testOptions()
File
- vendor/
symfony/ console/ Tests/ Formatter/ OutputFormatterStyleTest.php, line 64
Class
Namespace
Symfony\Component\Console\Tests\FormatterCode
public function testOptions() {
$style = new OutputFormatterStyle();
$style
->setOptions(array(
'reverse',
'conceal',
));
$this
->assertEquals("\33[7;8mfoo\33[27;28m", $style
->apply('foo'));
$style
->setOption('bold');
$this
->assertEquals("\33[7;8;1mfoo\33[27;28;22m", $style
->apply('foo'));
$style
->unsetOption('reverse');
$this
->assertEquals("\33[8;1mfoo\33[28;22m", $style
->apply('foo'));
$style
->setOption('bold');
$this
->assertEquals("\33[8;1mfoo\33[28;22m", $style
->apply('foo'));
$style
->setOptions(array(
'bold',
));
$this
->assertEquals("\33[1mfoo\33[22m", $style
->apply('foo'));
try {
$style
->setOption('foo');
$this
->fail('->setOption() throws an \\InvalidArgumentException when the option does not exist in the available options');
} catch (\Exception $e) {
$this
->assertInstanceOf('\\InvalidArgumentException', $e, '->setOption() throws an \\InvalidArgumentException when the option does not exist in the available options');
$this
->assertContains('Invalid option specified: "foo"', $e
->getMessage(), '->setOption() throws an \\InvalidArgumentException when the option does not exist in the available options');
}
try {
$style
->unsetOption('foo');
$this
->fail('->unsetOption() throws an \\InvalidArgumentException when the option does not exist in the available options');
} catch (\Exception $e) {
$this
->assertInstanceOf('\\InvalidArgumentException', $e, '->unsetOption() throws an \\InvalidArgumentException when the option does not exist in the available options');
$this
->assertContains('Invalid option specified: "foo"', $e
->getMessage(), '->unsetOption() throws an \\InvalidArgumentException when the option does not exist in the available options');
}
}