public function testOptions()
 {
     $style = new OutputFormatterStyle();
     $style->setOptions(array('reverse', 'conceal'));
     $this->assertEquals("foo", $style->apply('foo'));
     $style->setOption('bold');
     $this->assertEquals("foo", $style->apply('foo'));
     $style->unsetOption('reverse');
     $this->assertEquals("foo", $style->apply('foo'));
     $style->setOption('bold');
     $this->assertEquals("foo", $style->apply('foo'));
     $style->setOptions(array('bold'));
     $this->assertEquals("foo", $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');
     }
 }
 public function testOptions()
 {
     $style = new OutputFormatterStyle();
     $style->setOptions(array('reverse', 'conceal'));
     $this->assertEquals("foo", $style->apply('foo'));
     $style->setOption('bold');
     $this->assertEquals("foo", $style->apply('foo'));
     $style->unsetOption('reverse');
     $this->assertEquals("foo", $style->apply('foo'));
     $style->setOption('bold');
     $this->assertEquals("foo", $style->apply('foo'));
     $style->setOptions(array('bold'));
     $this->assertEquals("foo", $style->apply('foo'));
 }
예제 #3
0
 /**
  * Unsets some specific style option.
  *
  * @author             Art <*****@*****.**>
  *
  * @param string $option The option name
  *
  * @codeCoverageIgnore - nothing to test.
  */
 public function unsetOption($option)
 {
     $this->symfony->unsetOption($option);
 }