/** * Callback called at the end of specs processing. * * @param object $summary The execution summary instance. */ public function end($summary) { $toString = function ($instance) { return 'an instance of `' . get_class($instance) . '`'; }; foreach ($summary->logs() as $log) { if ($log->passed()) { continue; } switch ($log->type()) { case 'failed': foreach ($log->children() as $log) { if ($log->passed()) { continue; } $data = []; foreach ($log->data() as $key => $value) { $data[$key] = Text::toString($value, ['object' => ['method' => $toString]]); } $this->_json['errors'][] = ['spec' => trim(implode(' ', $log->messages())), 'suite' => $log->file(), 'data' => $data]; } break; case 'errored': $exception = $log->exception(); $this->_json['errors'][] = ['spec' => trim(implode(' ', $log->messages())), 'suite' => $log->file(), 'exception' => '`' . get_class($exception) . '` Code(' . $exception->getCode() . ')', 'trace' => $exception->getMessage()]; break; } } $this->_json['summary'] = ['total' => $summary->total(), 'passed' => $summary->passed(), 'pending' => $summary->pending(), 'skipped' => $summary->skipped(), 'excluded' => $summary->excluded(), 'failed' => $summary->failed(), 'errored' => $summary->errored()]; $this->write(json_encode($this->_json)); }
/** * Callback called at the end of specs processing. * * @param object $summary The execution summary instance. */ public function end($summary) { $this->write("# total {$summary->total()}\n"); $this->write("# passed {$summary->passed()}\n"); $this->write("# pending {$summary->pending()}\n"); $this->write("# skipped {$summary->skipped()}\n"); $this->write("# excluded {$summary->excluded()}\n"); $this->write("# failed {$summary->failed()}\n"); $this->write("# errored {$summary->errored()}\n"); }