/** * @test */ public function itShouldThrowsException() { $this->expectException(JsonLintViolationsException::class); $output = new PreCommitOutputWriter(JsonLintToolExecutor::CHECKING_MESSAGE); $jsonFilesResponse = JsonFilesResponseStub::createWithJsonData(); $this->shouldHandleQuery(new JsonFilesExtractorQuery($jsonFilesResponse->getFiles()), $jsonFilesResponse); $this->shouldWriteOutput($output->getMessage()); $errorTxt = null; foreach ($jsonFilesResponse->getFiles() as $file) { $error = 'ERROR'; $this->shouldProcessJsonLint($file, $error); $errorTxt .= $error; } $this->shouldWriteLnOutput($output->getFailMessage()); $this->shouldWriteLnOutput($output->setError($errorTxt)); $this->shouldWriteLnOutput(BadJobLogoResponse::paint($this->errorMessage)); $this->jsonLintToolCommandHandler->handle(new JsonLintToolCommand($jsonFilesResponse->getFiles(), $this->errorMessage)); }