PhpGitHooks\Module\Files\Tests\Stub\JsonFilesResponseStub::createWithJsonData PHP Метод

createWithJsonData() публичный статический Метод

public static createWithJsonData ( ) : JsonFilesResponse
Результат PhpGitHooks\Module\Files\Contract\Response\JsonFilesResponse
    public static function createWithJsonData()
    {
        return self::create(['file1.json', 'file2.json', 'file3.json', 'file4.json']);
    }

Usage Example

 /**
  * @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));
 }