/** * @test */ public function itShouldThrowsException() { $this->expectException(InvalidCommitMessageException::class); $configurationDataResponse = ConfigurationDataResponseStub::createCustom(true, true, true); $this->shouldHandleQuery(new ConfigurationDataFinderQuery(), $configurationDataResponse); $this->shouldGetInputFirstArgument('file'); $this->shouldFindCommitMessage('file', 'invalid commit message'); $this->shouldCallIsMerge(false); $this->commitMsgCommandHandler->handle(new CommitMsgCommand($this->getInput())); }
/** * @test */ public function itShouldWorksFine() { $configurationDataResponse = ConfigurationDataResponseStub::createCustom(false, false, true); $this->shouldHandleQuery(new ConfigurationDataFinderQuery(), $configurationDataResponse); $this->shouldWriteLnOutput(PrePushTool::PRE_PUSH_HOOK); $this->shouldExecutePrePushOriginal($this->remote, $this->url, ''); $this->shouldHandleCommand(new PhpUnitToolCommand($configurationDataResponse->getPrePush()->getPhpUnit()->isPhpunitRandomMode(), $configurationDataResponse->getPrePush()->getPhpUnit()->getPhpunitOptions(), $configurationDataResponse->getPrePush()->getErrorMessage())); $this->shouldHandleCommand(new StrictCoverageCommand($configurationDataResponse->getPrePush()->getPhpUnitStrictCoverage()->getMinimum(), $configurationDataResponse->getPrePush()->getErrorMessage())); $this->shouldHandleCommand(new GuardCoverageCommand($configurationDataResponse->getPreCommit()->getPhpUnitGuardCoverage()->getWarningMessage())); $this->shouldWriteLnOutput(GoodJobLogoResponse::paint($configurationDataResponse->getPrePush()->getRightMessage())); $this->prePushToolCommandHandler->handle(new PrePushToolCommand($this->remote, $this->url)); }