public function testGetCurrentReleaseVersionWithoutDefinedBranchType() { $this->detector = new GitFlowBranch(new Git()); system("git flow init -fd 1>/dev/null 2>&1"); system("git flow release start 2.2.2 1>/dev/null 2>&1"); $version = $this->detector->getCurrentVersion(); $this->assertEquals('2.2.2', $version->getVersion()); $this->assertEquals(GitFlowBranch::RELEASE, $this->detector->getBranchType()); }
protected function execute(InputInterface $input, OutputInterface $output) { $detector = new GitFlowBranch($this->getContext()->getVCS()); $newVersion = $detector->getCurrentVersion(); $this->getContext()->setNewVersion($newVersion); $currentVersion = $this->getContext()->getVersionDetector()->getCurrentVersion(); $type = $currentVersion->getDifferenceType($newVersion); if ($type === null) { throw new Exception('Could not detect a version difference.', 404); } $this->getContext()->setParameter('type', $type); //in case the type information is needed... $this->getContext()->getInformationCollector()->registerStandardRequest('type'); $this->getContext()->getInformationCollector()->setValueFor('type', $type); //push a git flow finish action to the post release list $action = new GitFlowFinishAction($detector->getBranchType()); $action->setContext($this->getContext()); $this->getContext()->getList(Context::POSTRELEASE_LIST)->push($action); parent::execute($input, $output); }