本文整理汇总了PHP中PhpSpec\Console\IO::isDecorated方法的典型用法代码示例。如果您正苦于以下问题:PHP IO::isDecorated方法的具体用法?PHP IO::isDecorated怎么用?PHP IO::isDecorated使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhpSpec\Console\IO
的用法示例。
在下文中一共展示了IO::isDecorated方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayFatal
public function displayFatal(CurrentExampleTracker $currentExample, $error)
{
if (null !== $error && $currentExample->getCurrentExample() || is_null($currentExample->getCurrentExample()) && defined('HHVM_VERSION')) {
ini_set('display_errors', "stderr");
$failedOpen = $this->io->isDecorated() ? '<failed>' : '';
$failedClosed = $this->io->isDecorated() ? '</failed>' : '';
$failedCross = $this->io->isDecorated() ? '✘' : '';
$this->io->writeln("{$failedOpen}{$failedCross} Fatal error happened while executing the following {$failedClosed}");
$this->io->writeln("{$failedOpen} {$currentExample->getCurrentExample()} {$failedClosed}");
$this->io->writeln("{$failedOpen} {$error['message']} in {$error['file']} on line {$error['line']} {$failedClosed}");
}
}
示例2: array
function it_should_not_color_output_text_report_unless_specified(\PHP_CodeCoverage $coverage, \PHP_CodeCoverage_Report_Text $text, SuiteEvent $event, IO $io)
{
$reports = array('text' => $text);
$this->beConstructedWith($coverage, $reports);
$this->setOptions(array('format' => 'text'));
$io->isVerbose()->willReturn(false);
$io->isDecorated()->willReturn(false);
$this->setIO($io);
$text->process($coverage, false)->willReturn('report');
$io->writeln('report')->shouldBeCalled();
$this->afterSuite($event);
}
示例3: updateProgressBar
/**
* @param IO $io
* @param array $progress
* @param int $total
*/
private function updateProgressBar(IO $io, array $progress, $total)
{
if ($io->isDecorated()) {
$progressBar = implode('', $progress);
$pad = $this->getIO()->getBlockWidth() - strlen(strip_tags($progressBar));
$io->writeTemp($progressBar . str_repeat(' ', $pad + 1) . $total);
} else {
$io->writeTemp('/' . implode('/', $progress) . '/ ' . $total . ' examples');
}
}