本文整理汇总了PHP中PhpSpec\Event\ExampleEvent::getBacktrace方法的典型用法代码示例。如果您正苦于以下问题:PHP ExampleEvent::getBacktrace方法的具体用法?PHP ExampleEvent::getBacktrace怎么用?PHP ExampleEvent::getBacktrace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhpSpec\Event\ExampleEvent
的用法示例。
在下文中一共展示了ExampleEvent::getBacktrace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formatBacktrace
/**
*
* @return string
*/
private function formatBacktrace()
{
$backtrace = '';
foreach ($this->event->getBacktrace() as $step) {
if (isset($step['line']) && isset($step['file'])) {
$backtrace .= "#{$step['line']} {$step['file']}";
$backtrace .= "<br />";
$backtrace .= PHP_EOL;
}
}
return rtrim($backtrace, "<br />" . PHP_EOL);
}
示例2: array
function it_writes_a_fail_message_for_a_failing_example(Template $template, ExampleEvent $event, Presenter $presenter)
{
$event->getTitle()->willReturn(self::EVENT_TITLE);
$event->getMessage()->willReturn(self::EVENT_MESSAGE);
$event->getBacktrace()->willReturn(self::$BACKTRACE);
$event->getException()->willReturn(new \Exception());
$template->render(Template::DIR . '/Template/ReportFailed.html', array('title' => self::EVENT_TITLE, 'message' => self::EVENT_MESSAGE, 'backtrace' => self::BACKTRACE, 'code' => self::CODE, 'index' => 1, 'specification' => 1))->shouldBeCalled();
$presenter->presentException(Argument::cetera())->willReturn(self::CODE);
$this->write(1);
}