protected function getGitHelper($isGitFolder = true, $tag = 'v1.0.0') { $helper = parent::getGitHelper($isGitFolder); $helper->remoteUpdate('cordoval')->shouldBeCalled(); $helper->getLastTagOnBranch('cordoval/head_ref')->willReturn($tag); return $helper; }
protected function getGitHelper($isGitFolder = true, $hasTag = true) { $helper = parent::getGitHelper($isGitFolder); $helper->getActiveBranchName()->willReturn('master'); if ($hasTag) { $helper->getLastTagOnBranch('master')->willReturn(self::TEST_TAG_NAME); $helper->getLogBetweenCommits(self::TEST_TAG_NAME, 'master')->willReturn([['sha' => '68bfa1d00', 'author' => 'Anonymous <*****@*****.**>', 'subject' => ' Another hack which fixes #123', 'message' => ' Another hack which fixes #123'], ['sha' => '68bfa1d05', 'author' => 'Anonymous <*****@*****.**>', 'subject' => ' Another hack which fixes GITHUB-500', 'message' => ' Another hack which fixes GITHUB-500']]); } else { $helper->getLastTagOnBranch()->willThrow(new \RuntimeException('fatal: No names found, cannot describe anything.')); } return $helper; }
protected function getGitHelper($isGitFolder = true, $branchExists = true, $localSync = true) { $helper = parent::getGitHelper($isGitFolder); $helper->remoteUpdate('gushphp')->shouldBeCalled(); $helper->remoteUpdate('cordoval')->shouldBeCalled(); $helper->stashBranchName()->shouldBeCalled(); $helper->checkout('head_ref')->shouldBeCalled(); $helper->createTempBranch('head_ref')->willReturn('temp--head_ref'); $helper->checkout('temp--head_ref', true)->shouldBeCalled(); $helper->squashCommits('gushphp/base_ref', 'temp--head_ref')->shouldBeCalled(); $helper->pushToRemote('cordoval', 'temp--head_ref:head_ref', false, true)->shouldBeCalled(); $helper->branchExists('head_ref')->willReturn($branchExists); if ($localSync) { $helper->reset('temp--head_ref', 'hard')->shouldBeCalled(); } $helper->restoreStashedBranch()->shouldBeCalled(); return $helper; }
private function getLocalGitHelper($wcReady = true, $hasChanges = true) { $gitHelper = parent::getGitHelper(); if ($wcReady) { $gitHelper->isWorkingTreeReady()->willReturn(true); $gitHelper->commit('wip', ['a'])->shouldNotBeCalled(); } else { $gitHelper->isWorkingTreeReady()->willReturn(false); $gitHelper->commit('wip', ['a'])->shouldBeCalled(); } $gitHelper->add('.')->shouldBeCalled(); if ($hasChanges) { $gitHelper->isWorkingTreeReady(true)->willReturn(false); $gitHelper->commit('cs-fixer', ['a'])->shouldBeCalled(); } else { $gitHelper->isWorkingTreeReady(true)->willReturn(true); $gitHelper->commit('cs-fixer', ['a'])->shouldNotBeCalled(); } return $gitHelper; }
private function getLocalGitHelper($message = null, $squash = false, $forceSquash = false, $fastForward = false) { $helper = parent::getGitHelper(); $mergeOperation = $this->prophesize('Gush\\Operation\\RemoteMergeOperation'); $mergeOperation->setTarget('gushphp', 'master')->shouldBeCalled(); $mergeOperation->setSource('gushphp', 'develop')->shouldBeCalled(); $mergeOperation->squashCommits($squash, $forceSquash)->shouldBeCalled(); $mergeOperation->useFastForward($fastForward)->shouldBeCalled(); $mergeOperation->setMergeMessage($message, true)->shouldBeCalled(); $mergeOperation->performMerge()->willReturn(self::MERGE_HASH); $mergeOperation->pushToRemote()->shouldBeCalled(); $helper->createRemoteMergeOperation()->willReturn($mergeOperation->reveal()); return $helper; }
protected function getGitHelper($isGitDir = true) { $files = [$this->srcDir . '/metatest.php', $this->srcDir . '/metatest.css', $this->srcDir . '/metatest.js', $this->srcDir . '/metatest.twig']; $helper = parent::getGitHelper($isGitDir); $helper->listFiles()->willReturn($files); return $helper; }
private function getLocalGitHelper($message = null, $squash = false, $forceSquash = false, $switch = null, $withComments = true, $fastForward = false) { $helper = parent::getGitHelper(); if ($withComments) { $helper->remoteUpdate('gushphp')->shouldBeCalled(); $helper->addNotes(Argument::any(), self::MERGE_HASH, 'github-comments')->shouldBeCalled(); $helper->pushToRemote('gushphp', 'refs/notes/github-comments')->shouldBeCalled(); } if (null !== $message) { $mergeOperation = $this->prophesize('Gush\\Operation\\RemoteMergeOperation'); $mergeOperation->setTarget('gushphp', 'base_ref')->shouldBeCalled(); $mergeOperation->setSource('cordoval', 'head_ref')->shouldBeCalled(); $mergeOperation->squashCommits($squash, $forceSquash)->shouldBeCalled(); $mergeOperation->switchBase($switch)->shouldBeCalled(); $mergeOperation->useFastForward($fastForward)->shouldBeCalled(); $mergeOperation->setMergeMessage(Argument::that(function ($closure) use($message, $switch) { $closureMessage = trim($closure($switch ?: 'base_ref', 'temp--head_ref')); $result = trim($message) === $closureMessage; return $result; }))->shouldBeCalled(); $mergeOperation->performMerge()->willReturn(self::MERGE_HASH); $mergeOperation->pushToRemote()->shouldBeCalled(); $helper->createRemoteMergeOperation()->willReturn($mergeOperation->reveal()); $helper->getLogBetweenCommits($switch ?: 'base_ref', 'temp--head_ref')->willReturn($squash ? $this->squashedCommits : $this->commits); } return $helper; }