/** * Captures hook call result. * * @param CallResult $hookCallResult */ private function captureHookStat(CallResult $hookCallResult) { $callee = $hookCallResult->getCall()->getCallee(); $hook = (string) $callee; $path = $callee->getPath(); $stdOut = $hookCallResult->getStdOut(); $error = $hookCallResult->getException() ? $this->exceptionPresenter->presentException($hookCallResult->getException()) : null; $stat = new HookStat($hook, $path, $error, $stdOut); $this->statistics->registerHookStat($stat); }
/** * Prints teardown hook call result. * * @param OutputPrinter $printer * @param CallResult $callResult */ private function printTeardownHookCallResult(OutputPrinter $printer, CallResult $callResult) { if (!$callResult->hasStdOut() && !$callResult->hasException()) { return; } $resultCode = $callResult->hasException() ? TestResult::FAILED : TestResult::PASSED; $style = $this->resultConverter->convertResultCodeToString($resultCode); $hook = $callResult->getCall()->getCallee(); $path = $hook->getPath(); $printer->writeln(sprintf('%s│', $this->indentText)); $this->printHookCallStdOut($printer, $callResult, $this->indentText); $this->printHookCallException($printer, $callResult, $this->indentText); $printer->writeln(sprintf('%s└─ {+%s}@%s{-%s} {+comment}# %s{-comment}', $this->indentText, $style, $hook, $style, $path)); if ($this->newlineAfter) { $printer->writeln(); } }