function it_should_update_the_console(FatalPresenter $currentExampleWriter) { $currentExample = new CurrentExampleTracker(); $error = array('type' => 1, 'message' => 'Hello'); $currentExample->getCurrentExample('Hello'); $currentExampleWriter->displayFatal($currentExample, $error)->shouldBeCalled(); $this->runAction($error); }
function it_should_call_afterSuiteEvent(SuiteEvent $example) { $fatalError = '3'; $currentExample = new CurrentExampleTracker(); $currentExample->setCurrentExample("Exited with code: " . $fatalError); $example->getResult()->willReturn($fatalError); $this->afterSuiteEvent($example); $example->getResult()->shouldHaveBeenCalled(); }
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}"); } }
function it_should_be_null_on_construction() { $currentExample = new CurrentExampleTracker(); expect($currentExample->getCurrentExample())->toBe(null); }
public function afterSuiteEvent(SuiteEvent $event) { $this->currentExample->setCurrentExample('Exited with code: ' . $event->getResult()); }