getResult() public method

public getResult ( )
Esempio n. 1
0
 public function afterExample(ExampleEvent $event)
 {
     $this->globalResult = max($this->globalResult, $event->getResult());
     switch ($event->getResult()) {
         case ExampleEvent::PASSED:
             $this->passedEvents[] = $event;
             break;
         case ExampleEvent::PENDING:
             $this->pendingEvents[] = $event;
             break;
         case ExampleEvent::FAILED:
             $this->failedEvents[] = $event;
             break;
         case ExampleEvent::BROKEN:
             $this->brokenEvents[] = $event;
             break;
     }
 }
Esempio n. 2
0
 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);
     $exception->cause = $event->getExample()->getFunction();
     $message = $this->presenter->presentException($exception, $this->io->isVerbose());
     if (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()->getFunction()->getStartLine(), $event->getExample()->getTitle()));
         $this->io->writeln(sprintf('<failed>%s</failed>', lcfirst($message)), 6);
     } else {
         $this->io->writeln(sprintf('<broken-bg>%s</broken-bg>', $title));
         $this->io->writeln(sprintf('<lineno>%4d</lineno>  <broken>! %s</broken>', $event->getExample()->getFunction()->getStartLine(), $event->getExample()->getTitle()));
         $this->io->writeln(sprintf('<broken>%s</broken>', lcfirst($message)), 6);
     }
     $this->io->writeln();
 }
Esempio n. 3
0
 protected function printException(ExampleEvent $event, $depth = null)
 {
     if (null === ($exception = $event->getException())) {
         return;
     }
     // TODO: add cause to exception interface
     $exception->cause = $event->getExample()->getFunction();
     $depth = $depth ?: $event->getExample()->getDepth() * 2 + 6;
     $message = $this->presenter->presentException($exception, $this->io->isVerbose());
     if (ExampleEvent::FAILED === $event->getResult()) {
         $this->io->writeln(sprintf('<failed>%s</failed>', lcfirst($message)), $depth);
     } else {
         $this->io->writeln(sprintf('<broken>%s</broken>', lcfirst($message)), $depth);
     }
 }