Inheritance: implements PhpGitHooks\Module\Tests\Infrastructure\Stub\RandomStubInterface
 /**
  * @test
  */
 public function itShouldWorksFine()
 {
     $phpCsFixerOptions = PhpCsFixerOptionsStub::random();
     $configurationData = ConfigurationDataResponseStub::createAllEnabled();
     $phpFiles = FilesCommittedStub::createOnlyPhpFiles();
     $outputMessagePsr0 = new PreCommitOutputWriter('Checking psr0 code style with PHP-CS-FIXER');
     $this->shouldWriteOutput($outputMessagePsr0->getMessage());
     foreach ($phpFiles as $file) {
         $this->shouldProcessPhpCsFixerTool($file, 'psr0', $phpCsFixerOptions->value(), null);
     }
     $this->shouldWriteLnOutput($outputMessagePsr0->getSuccessfulMessage());
     $outputMessagePsr1 = new PreCommitOutputWriter('Checking psr1 code style with PHP-CS-FIXER');
     $this->shouldWriteOutput($outputMessagePsr1->getMessage());
     foreach ($phpFiles as $file) {
         $this->shouldProcessPhpCsFixerTool($file, 'psr1', $phpCsFixerOptions->value(), null);
     }
     $this->shouldWriteLnOutput($outputMessagePsr1->getSuccessfulMessage());
     $outputMessagePsr2 = new PreCommitOutputWriter('Checking psr2 code style with PHP-CS-FIXER');
     $this->shouldWriteOutput($outputMessagePsr2->getMessage());
     foreach ($phpFiles as $file) {
         $this->shouldProcessPhpCsFixerTool($file, 'psr2', $phpCsFixerOptions->value(), null);
     }
     $this->shouldWriteLnOutput($outputMessagePsr2->getSuccessfulMessage());
     $outputMessageSymfony = new PreCommitOutputWriter('Checking symfony code style with PHP-CS-FIXER');
     $this->shouldWriteOutput($outputMessageSymfony->getMessage());
     foreach ($phpFiles as $file) {
         $this->shouldProcessPhpCsFixerTool($file, 'symfony', $phpCsFixerOptions->value(), null);
     }
     $this->shouldWriteLnOutput($outputMessageSymfony->getSuccessfulMessage());
     $this->phpCsFixerToolCommandHandler->handle(new PhpCsFixerToolCommand($phpFiles, $configurationData->getPreCommit()->getPhpCsFixer()->isPhpCsFixerPsr0(), $configurationData->getPreCommit()->getPhpCsFixer()->isPhpCsFixerPsr1(), $configurationData->getPreCommit()->getPhpCsFixer()->isPhpCsFixerPsr2(), $configurationData->getPreCommit()->getPhpCsFixer()->isPhpCsFixerSymfony(), $phpCsFixerOptions->value(), $configurationData->getPreCommit()->getErrorMessage()));
 }
Beispiel #2
0
 /**
  * @return PhpCsFixer
  */
 public static function createEnabled()
 {
     return self::create(new Undefined(false), EnabledStub::create(true), PhpCsFixerLevelsStub::createEnabled(), PhpCsFixerOptionsStub::create(null));
 }