getSuccessfulMessage() public method

public getSuccessfulMessage ( ) : string
return string
示例#1
0
 /**
  * @param array  $files
  * @param string $errorMessage
  *
  * @throws ComposerFilesNotFoundException
  */
 public function execute(array $files, $errorMessage)
 {
     $composerFilesResponse = $this->getComposerFilesResponse($files);
     $this->outputMessage = new PreCommitOutputWriter(self::CHECKING_MESSAGE);
     if (true === $composerFilesResponse->isExists()) {
         $this->output->write($this->outputMessage->getMessage());
         $this->executeTool($composerFilesResponse->isJsonFile(), $composerFilesResponse->isLockFile(), $errorMessage);
         $this->output->writeln($this->outputMessage->getSuccessfulMessage());
     }
 }
 /**
  * @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()));
 }
 public function execute(MinimumStrictCoverage $minimumStrictCoverage, $errorMessage)
 {
     $outputMessage = new PreCommitOutputWriter(self::EXECUTE_MESSAGE);
     $this->output->write($outputMessage->getMessage());
     $this->strictCoverageTool->run($minimumStrictCoverage, $errorMessage);
     $this->output->writeln($outputMessage->getSuccessfulMessage());
 }
 /**
  * @test
  */
 public function itShouldWorksFine()
 {
     $files = FilesCommittedStub::createAllFiles();
     $output = new PreCommitOutputWriter(ComposerTool::CHECKING_MESSAGE);
     $this->shouldWriteOutput($output->getMessage());
     $this->shouldHandleQuery(new ComposerFilesExtractorQuery($files), ComposerFilesResponseStub::createValidData());
     $this->shouldWriteLnOutput($output->getSuccessfulMessage());
     $this->composerToolCommandHandler->handle(new ComposerToolCommand($files, $this->errorMessage));
 }
示例#5
0
 /**
  * @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);
 }
 /**
  * @test
  */
 public function itShouldWorksFine()
 {
     $minimumStrictCoverage = MinimumStrictCoverageStub::create(90.0);
     $outputMessage = new PreCommitOutputWriter(StrictCoverageToolExecutor::EXECUTE_MESSAGE);
     $this->shouldWriteOutput($outputMessage->getMessage());
     $this->shouldProcessStrictCoverage(91.0);
     $this->shouldWriteLnOutput($outputMessage->getSuccessfulMessage());
     $command = new StrictCoverageCommand($minimumStrictCoverage->value(), $this->errorMessage);
     $this->strictCoverageToolCommandHandler->handle($command);
 }
 /**
  * @test
  */
 public function itShouldWorksFine()
 {
     $output = new PreCommitOutputWriter(PhpCsTool::EXECUTE_MESSAGE);
     $files = FilesCommittedStub::createOnlyPhpFiles();
     $this->shouldWriteOutput($output->getMessage());
     foreach ($files as $file) {
         $this->shouldProcessPhpCsTool($file, 'PSR2', null);
     }
     $this->shouldWriteLnOutput($output->getSuccessfulMessage());
     $this->phpCsToolCommandHandler->handle(new PhpCsToolCommand($files, 'PSR2', HookQuestions::PRE_COMMIT_ERROR_MESSAGE_DEFAULT));
 }
 /**
  * @test
  */
 public function itShouldWorksFine()
 {
     $phpFiles = FilesCommittedStub::createOnlyPhpFiles();
     $outputMessage = new PreCommitOutputWriter(PhpLintTool::RUNNING_PHPLINT);
     $this->shouldWriteOutput($outputMessage->getMessage());
     foreach ($phpFiles as $file) {
         $this->shouldProcessPhpLintTool($file, null);
     }
     $this->shouldWriteLnOutput($outputMessage->getSuccessfulMessage());
     $this->phpLintToolCommandHandler->handle(new PhpLintToolCommand($phpFiles, HookQuestions::PRE_COMMIT_ERROR_MESSAGE_DEFAULT));
 }
 /**
  * @test
  */
 public function itShouldWorksFine()
 {
     $outputMessage = new PreCommitOutputWriter(GuardCoverageTool::CHECKING_MESSAGE);
     $currentCoverage = 70.0;
     $previousCoverage = 60.0;
     $this->shouldProcessStrictCoverage($currentCoverage);
     $this->shouldWriteOutput($outputMessage->getMessage());
     $this->shouldReadGuardCoverage($previousCoverage);
     $this->shouldWriteLnOutput($this->buildStrictCoverageSuccessfulMessage($currentCoverage, $previousCoverage, $outputMessage->getSuccessfulMessage()));
     $this->shouldWriteGuardCoverage($currentCoverage);
     $this->guardCoverageToolCommandHandler->handle(new GuardCoverageCommand(HookQuestions::PHPUNIT_GUARD_COVERAGE_MESSAGE_DEFAULT));
 }
 /**
  * @test
  */
 public function itShouldExecuteTool()
 {
     $files = JsonFilesResponseStub::createWithJsonData();
     $output = new PreCommitOutputWriter(JsonLintToolExecutor::CHECKING_MESSAGE);
     $this->shouldHandleQuery(new JsonFilesExtractorQuery($files->getFiles()), $files);
     $this->shouldWriteOutput($output->getMessage());
     foreach ($files->getFiles() as $file) {
         $this->shouldProcessJsonLint($file, []);
     }
     $this->shouldWriteLnOutput($output->getSuccessfulMessage());
     $this->jsonLintToolCommandHandler->handle(new JsonLintToolCommand($files->getFiles(), $this->errorMessage));
 }
 /**
  * @test
  */
 public function itShouldWorksFine()
 {
     $phpMdOptions = PhpMdOptionsStub::random();
     $errorMessage = HookQuestions::PRE_COMMIT_ERROR_MESSAGE_DEFAULT;
     $phpFiles = FilesCommittedStub::createOnlyPhpFiles();
     $outputMessage = new PreCommitOutputWriter(PhpMdTool::CHECKING_MESSAGE);
     $this->shouldWriteOutput($outputMessage->getMessage());
     foreach ($phpFiles as $phpFile) {
         $this->shouldProcessPhpMdTool($phpFile, $phpMdOptions->value(), null);
     }
     $this->shouldWriteLnOutput($outputMessage->getSuccessfulMessage());
     $command = new PhpMdToolCommand($phpFiles, $phpMdOptions->value(), $errorMessage);
     $this->phpMdToolCommandHandler->handle($command);
 }
 /**
  * @param array  $files
  * @param string $errorMessage
  *
  * @throws JsonLintViolationsException
  */
 public function execute(array $files, $errorMessage)
 {
     $outputMessage = new PreCommitOutputWriter(self::CHECKING_MESSAGE);
     $this->output->write($outputMessage->getMessage());
     $errors = [];
     foreach ($files as $file) {
         $errors[] = $this->jsonLintProcessor->process($file);
     }
     $errors = array_filter($errors);
     if (!empty($errors)) {
         $this->output->writeln($outputMessage->getFailMessage());
         $this->output->writeln($outputMessage->setError(implode('', $errors)));
         $this->output->writeln(BadJobLogoResponse::paint($errorMessage));
         throw new JsonLintViolationsException(implode('', $errors));
     }
     $this->output->writeln($outputMessage->getSuccessfulMessage());
 }
示例#13
0
 /**
  * @param array  $files
  * @param string $standard
  * @param string $errorMessage
  *
  * @throws PhpCsViolationException
  */
 public function execute(array $files, $standard, $errorMessage)
 {
     $outputMessage = new PreCommitOutputWriter(self::EXECUTE_MESSAGE);
     $this->output->write($outputMessage->getMessage());
     $errors = [];
     foreach ($files as $file) {
         $errors[] = $this->phpCsToolProcessor->process($file, $standard);
     }
     $errors = array_filter($errors);
     if (!empty($errors)) {
         $this->output->writeln($outputMessage->getFailMessage());
         $this->output->writeln($outputMessage->setError(implode('', $errors)));
         $this->output->writeln(BadJobLogoResponse::paint($errorMessage));
         throw new PhpCsViolationException();
     }
     $this->output->writeln($outputMessage->getSuccessfulMessage());
 }
示例#14
0
 /**
  * @param array  $files
  * @param string $level
  * @param string $options
  * @param string $errorMessage
  *
  * @throws PhpCsFixerViolationsException
  */
 private function executeTool(array $files, $level, $options, $errorMessage)
 {
     $outputMessage = new PreCommitOutputWriter(sprintf('Checking %s code style with PHP-CS-FIXER', $level));
     $this->output->write($outputMessage->getMessage());
     $errors = [];
     foreach ($files as $file) {
         $errors[] = $this->phpCsFixerToolProcessor->process($file, $level, $options);
     }
     $errors = array_filter($errors);
     if (!empty($errors)) {
         $this->output->writeln($outputMessage->getFailMessage());
         $errorsText = $outputMessage->setError(implode('', $errors));
         $this->output->writeln($errorsText);
         $this->output->writeln(BadJobLogoResponse::paint($errorMessage));
         throw new PhpCsFixerViolationsException();
     }
     $this->output->writeln($outputMessage->getSuccessfulMessage());
 }