getStyle() public method

Gets style options from style with specified name.
public getStyle ( string $name ) : Symfony\Component\Console\Formatter\OutputFormatterStyleInterface
$name string
return Symfony\Component\Console\Formatter\OutputFormatterStyleInterface
Esempio n. 1
0
 public function testNewStyle()
 {
     $formatter = new OutputFormatter(true);
     $style = new OutputFormatterStyle('blue', 'white');
     $formatter->setStyle('test', $style);
     $this->assertEquals($style, $formatter->getStyle('test'));
     $this->assertNotEquals($style, $formatter->getStyle('info'));
     $this->assertEquals("some custom msg", $formatter->format('<test>some custom msg</test>'));
 }
Esempio n. 2
0
 public function testNewStyle()
 {
     $formatter = new OutputFormatter(true);
     $style = $this->getMockBuilder('Symfony\\Component\\Console\\Formatter\\OutputFormatterStyleInterface')->getMock();
     $formatter->setStyle('test', $style);
     $this->assertEquals($style, $formatter->getStyle('test'));
     $this->assertNotEquals($style, $formatter->getStyle('info'));
     $style->expects($this->once())->method('apply')->will($this->returnValue('[STYLE_BEG]some custom msg[STYLE_END]'));
     $this->assertEquals("[STYLE_BEG]some custom msg[STYLE_END]", $formatter->format('<test>some custom msg</test>'));
 }