本文整理匯總了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);
}