本文整理汇总了PHP中PhpSpec\Console\IO::isVerbose方法的典型用法代码示例。如果您正苦于以下问题:PHP IO::isVerbose方法的具体用法?PHP IO::isVerbose怎么用?PHP IO::isVerbose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhpSpec\Console\IO
的用法示例。
在下文中一共展示了IO::isVerbose方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printException
/**
* @param ExampleEvent $event
*/
protected function printException(ExampleEvent $event)
{
if (null === ($exception = $event->getException())) {
return;
}
$title = str_replace('\\', DIRECTORY_SEPARATOR, $event->getSpecification()->getTitle());
$title = str_pad($title, 50, ' ', STR_PAD_RIGHT);
$message = $this->getPresenter()->presentException($exception, $this->io->isVerbose());
if ($exception instanceof PendingException) {
$this->io->writeln(sprintf('<pending-bg>%s</pending-bg>', $title));
$this->io->writeln(sprintf('<lineno>%4d</lineno> <pending>- %s</pending>', $event->getExample()->getFunctionReflection()->getStartLine(), $event->getExample()->getTitle()));
$this->io->writeln(sprintf('<pending>%s</pending>', lcfirst($message)), 6);
$this->io->writeln();
} elseif ($exception instanceof SkippingException) {
if ($this->io->isVerbose()) {
$this->io->writeln(sprintf('<skipped-bg>%s</skipped-bg>', $title));
$this->io->writeln(sprintf('<lineno>%4d</lineno> <skipped>? %s</skipped>', $event->getExample()->getFunctionReflection()->getStartLine(), $event->getExample()->getTitle()));
$this->io->writeln(sprintf('<skipped>%s</skipped>', lcfirst($message)), 6);
$this->io->writeln();
}
} elseif (ExampleEvent::FAILED === $event->getResult()) {
$this->io->writeln(sprintf('<failed-bg>%s</failed-bg>', $title));
$this->io->writeln(sprintf('<lineno>%4d</lineno> <failed>✘ %s</failed>', $event->getExample()->getFunctionReflection()->getStartLine(), $event->getExample()->getTitle()));
$this->io->writeln(sprintf('<failed>%s</failed>', lcfirst($message)), 6);
$this->io->writeln();
} else {
$this->io->writeln(sprintf('<broken-bg>%s</broken-bg>', $title));
$this->io->writeln(sprintf('<lineno>%4d</lineno> <broken>! %s</broken>', $event->getExample()->getFunctionReflection()->getStartLine(), $event->getExample()->getTitle()));
$this->io->writeln(sprintf('<broken>%s</broken>', lcfirst($message)), 6);
$this->io->writeln();
}
}
示例2: printSpecificException
/**
* @param ExampleEvent $event
* @param string $type
*/
protected function printSpecificException(ExampleEvent $event, $type)
{
$title = str_replace('\\', DIRECTORY_SEPARATOR, $event->getSpecification()->getTitle());
$message = $this->getPresenter()->presentException($event->getException(), $this->io->isVerbose());
foreach (explode("\n", wordwrap($title, $this->io->getBlockWidth(), "\n", true)) as $line) {
$this->io->writeln(sprintf('<%s-bg>%s</%s-bg>', $type, str_pad($line, $this->io->getBlockWidth()), $type));
}
$this->io->writeln(sprintf('<lineno>%4d</lineno> <%s>- %s</%s>', $event->getExample()->getFunctionReflection()->getStartLine(), $type, $event->getExample()->getTitle(), $type));
$this->io->writeln(sprintf('<%s>%s</%s>', $type, lcfirst($message), $type), 6);
$this->io->writeln();
}
示例3: array
function it_should_provide_extra_output_in_verbose_mode(\PHP_CodeCoverage $coverage, \PHP_CodeCoverage_Report_HTML $html, SuiteEvent $event, IO $io)
{
$reports = array('html' => $html);
$this->beConstructedWith($coverage, $reports);
$this->setOptions(array('format' => 'html', 'output' => array('html' => 'coverage')));
$io->isVerbose()->willReturn(true);
$this->setIO($io);
$io->writeln('')->shouldBeCalled();
$io->writeln('Generating code coverage report in html format ...')->shouldBeCalled();
$this->afterSuite($event);
}