public function format(Reporter $r, ExampleGroup $suite, $verbosity = false)
 {
     if (!$suite->hasFailures()) {
         return;
     }
     $this->output->writeln("");
     $this->output->writeln("<dspec-fail>Failures</dspec-fail>:");
     $this->output->writeln("");
     static::traverse($suite, $this->output, 0, $verbosity);
 }
Example #2
0
 public function format(Reporter $r, ExampleGroup $suite, $verbose = false)
 {
     $duration = $suite->getTime();
     $total = $suite->total();
     $failures = $r->getFailures();
     $failureCount = count($failures);
     $passCount = count($r->getPasses());
     $format = $failureCount > 0 ? 'error' : 'info';
     if ($failureCount) {
         $resultLine = sprintf("<dspec-bold-fail>✖</dspec-bold-fail> <dspec-fail>%d of %d examples failed</dspec-fail>", $failureCount, $total);
     } else {
         $resultLine = sprintf("<dspec-bold-pass>✔</dspec-bold-pass> <dspec-pass>%d example%s passed</dspec-pass>", $passCount, $passCount != 1 ? 's' : '');
     }
     if (count($r->getPending())) {
         $resultLine .= sprintf(", <dspec-pending>%d pending</dspec-pending>", count($r->getPending()));
     }
     if (count($r->getSkipped())) {
         $resultLine .= sprintf(", <dspec-skipped>%d skipped</dspec-skipped>", count($r->getSkipped()));
     }
     $this->output->writeln(sprintf("%s <dspec-meta>(%ss)</dspec-meta>", $resultLine, round($duration, 5)));
 }