/** * @param MinimumStrictCoverage $minimumStrictCoverage * @param string $errorMessage * * @throws InvalidStrictCoverageException */ public function run(MinimumStrictCoverage $minimumStrictCoverage, $errorMessage) { $currentCoverage = $this->strictCoverageProcessor->process(); if ($minimumStrictCoverage->value() > $currentCoverage) { $this->output->writeln(BadJobLogoResponse::paint($errorMessage)); throw new InvalidStrictCoverageException($currentCoverage, $minimumStrictCoverage->value()); } }
/** * @param string $warningMessage */ public function run($warningMessage) { $outputMessage = new PreCommitOutputWriter(self::CHECKING_MESSAGE); $this->output->write($outputMessage->getMessage()); $this->currentCoverage = $this->strictCoverageProcessor->process(); $this->previousCoverage = $this->guardReader->read(); true === $this->isLowerCurrentCoverage() ? $this->output->writeln(sprintf("\n<bg=yellow;options=bold>%s Previous coverage %s, current coverage %s.</>", $warningMessage, $this->previousCoverage, $this->currentCoverage)) : $this->output->writeln($outputMessage->getSuccessfulMessage() . $this->printGuardCoverage()); $this->guardWriter->write($this->currentCoverage); }