本文整理汇总了PHP中Symfony\Component\Console\Formatter\OutputFormatter::hasStyle方法的典型用法代码示例。如果您正苦于以下问题:PHP OutputFormatter::hasStyle方法的具体用法?PHP OutputFormatter::hasStyle怎么用?PHP OutputFormatter::hasStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Console\Formatter\OutputFormatter
的用法示例。
在下文中一共展示了OutputFormatter::hasStyle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testNotDecoratedFormatter
public function testNotDecoratedFormatter()
{
$formatter = new OutputFormatter(false);
$this->assertTrue($formatter->hasStyle('error'));
$this->assertTrue($formatter->hasStyle('info'));
$this->assertTrue($formatter->hasStyle('comment'));
$this->assertTrue($formatter->hasStyle('question'));
$this->assertEquals("some error", $formatter->format('<error>some error</error>'));
$this->assertEquals("some info", $formatter->format('<info>some info</info>'));
$this->assertEquals("some comment", $formatter->format('<comment>some comment</comment>'));
$this->assertEquals("some question", $formatter->format('<question>some question</question>'));
$formatter->setDecorated(true);
$this->assertEquals("[37;41msome error[0m", $formatter->format('<error>some error</error>'));
$this->assertEquals("[32msome info[0m", $formatter->format('<info>some info</info>'));
$this->assertEquals("[33msome comment[0m", $formatter->format('<comment>some comment</comment>'));
$this->assertEquals("[30;46msome question[0m", $formatter->format('<question>some question</question>'));
}