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(HtmlTemplate::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); }
function it_should_return_presented_exceptions_from_the_decorated_presenter_unchanged(Presenter $presenter, \Exception $exception) { $presenter->presentException($exception, true)->willReturn('exc'); $this->presentException($exception, true)->shouldReturn('exc'); }
/** * @param int $index */ public function write($index) { $code = $this->presenter->presentException($this->event->getException(), true); $this->template->render(Template::DIR . '/Template/ReportFailed.html', array('title' => htmlentities(strip_tags($this->event->getTitle())), 'message' => htmlentities(strip_tags($this->event->getMessage())), 'backtrace' => $this->formatBacktrace(), 'code' => $code, 'index' => self::$failingExamplesCount++, 'specification' => $index)); }