add() public method

Adds a style.
public add ( Style $style )
$style Style The style to add.
Ejemplo n.º 1
0
 /**
  * Adds a style to the style set.
  *
  * @param Style $style The style to add.
  *
  * @return static The current instance.
  *
  * @see StyleSet::add()
  */
 public function addStyle(Style $style)
 {
     if (!$this->styleSet) {
         $this->styleSet = new DefaultStyleSet();
     }
     $this->styleSet->add($style);
     return $this;
 }
Ejemplo n.º 2
0
 public function testIsEmpty()
 {
     $styleSet = new StyleSet();
     $this->assertTrue($styleSet->isEmpty());
     $styleSet->add(Style::tag('style'));
     $this->assertFalse($styleSet->isEmpty());
 }
 public function testUseConfiguredStyleSet()
 {
     $styleSet = new StyleSet();
     $styleSet->add(Style::tag('custom'));
     $this->config->setStyleSet($styleSet)->beginCommand('command')->setHandler(new CallbackHandler(function (Args $args, IO $io) {
         PHPUnit_Framework_Assert::assertSame('text', $io->removeFormat('<custom>text</custom>'));
         return 123;
     }))->end();
     $application = new ConsoleApplication($this->config);
     $args = new StringArgs('command');
     $inputStream = new StringInputStream();
     $outputStream = new BufferedOutputStream();
     $errorStream = new BufferedOutputStream();
     $status = $application->run($args, $inputStream, $outputStream, $errorStream);
     $this->assertSame(123, $status);
 }