public function postRun(Scenario $scenario, ValueBag $values, ValueBag $extra) { if ($extra->has('blackfire_build')) { $build = $extra->get('blackfire_build'); // did we profiled anything? if (!$build->getJobCount()) { // don't finish the build as it won't work with 0 profiles $this->logger->error(sprintf('Report "%s" aborted as it has no profiles', $scenario->getTitle())); $extra->remove('blackfire_build'); return; } $extra->set('blackfire_report', $report = $this->blackfire->endBuild($build)); $extra->remove('blackfire_build'); } // avoid getting the report if not needed if (!$this->logger) { return; } try { if ($report->isErrored()) { $this->logger->critical(sprintf('Report "%s" errored', $scenario->getTitle())); } else { if ($report->isSuccessful()) { $this->logger->debug(sprintf('Report "%s" pass', $scenario->getTitle())); } else { $this->logger->error(sprintf('Report "%s" failed', $scenario->getTitle())); } } } catch (BlackfireException $e) { $this->logger->critical(sprintf('Report "%s" is not available (%s)', $scenario->getTitle(), $e->getMessage())); } $this->logger->info(sprintf('Report "%s" URL: %s', $scenario->getTitle(), $report->getUrl())); }