/** * @param IOInterface $input */ public function process(IOInterface $input) { $this->io = $input; $configData = $this->configurationFileReader->getData(); $preCommit = $this->preCommitProcess($configData); if (true === $preCommit->isEnabled()) { $this->hookCopier->copyPreCommitHook(); } $commitMsg = $this->commitMsgProcess($configData); if (true === $commitMsg->isEnabled()) { $this->hookCopier->copyCommitMsgHook(); } $prePush = $this->prePushProcess($configData); if (true === $prePush->isEnabled()) { $this->hookCopier->copyPrePushHook(); } $configArray = ConfigurationArrayTransformer::transform($preCommit, $commitMsg, $prePush); $this->configurationFileWriter->write($configArray); }
/** * @test */ public function itShouldNotMakeAnyQuestions() { $data = ConfigurationArrayTransformer::transform(PreCommitStub::createAllEnabled(), CommitMsgStub::createEnabled(), PrePushStub::createAllEnabled()); $this->shouldReadConfigurationData(ConfigStub::createEnabled()); $this->shouldCopyPreCommitHook(); $this->shouldCopyCommitMsgHook(); $this->shouldCopyPrePushHook(); $this->shouldWriteConfigurationData($data); $command = new ConfigurationProcessorCommand($this->getIOInterface()); $this->configurationProcessorCommandHandler->handle($command); }