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;
 }
Example #2
0
 protected function getGitConfigHelper($hasRemote = true)
 {
     $helper = parent::getGitConfigHelper();
     $helper->getRemoteInfo('origin')->willReturn(['host' => 'github.com', 'vendor' => 'gushphp', 'repo' => 'gush']);
     $helper->remoteExists('cordoval')->willReturn(false);
     $helper->remoteExists('origin')->willReturn($hasRemote);
     $helper->getGitConfig('remote.origin.url')->willReturn('git@github.com:gushphp/gush.git');
     return $helper;
 }
 protected function getGitConfigHelper($expected = true)
 {
     $helper = parent::getGitConfigHelper();
     if ($expected) {
         $helper->ensureRemoteExists('cordoval', 'gush')->shouldBeCalled();
         $helper->ensureRemoteExists('gushphp', 'gush')->shouldBeCalled();
     }
     return $helper;
 }
 protected function getGitConfigHelper($localBranchExists = false, $remoteMatches = false)
 {
     $helper = parent::getGitConfigHelper();
     $helper->ensureRemoteExists('cordoval', 'gush')->shouldBeCalled();
     if (!$localBranchExists) {
         $helper->setGitConfig('branch.head_ref.remote', 'cordoval', true)->shouldBeCalled();
     } else {
         $helper->getGitConfig('branch.head_ref.remote')->willReturn($remoteMatches ? 'cordoval' : 'someone');
     }
     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;
 }
Example #9
0
 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;
 }
 protected function getGitConfigHelper($remoteName = 'cordoval', $url = 'git@github.com:cordoval/gush.git')
 {
     $gitHelper = parent::getGitConfigHelper();
     $gitHelper->setRemote($remoteName, $url)->shouldBeCalled();
     return $gitHelper;
 }
 protected function getGitConfigHelper($sourceOrg = 'cordoval', $sourceRepo = 'gush')
 {
     $helper = parent::getGitConfigHelper();
     $helper->ensureRemoteExists('gushphp', 'gush')->shouldBeCalled();
     $helper->remoteExists($sourceOrg, $sourceRepo)->willReturn();
     $helper->ensureRemoteExists($sourceOrg, $sourceRepo)->willReturn();
     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;
 }
Example #13
0
 protected function getGitConfigHelper($org = 'gushphp', $repo = 'gush')
 {
     $helper = parent::getGitConfigHelper();
     $helper->ensureRemoteExists($org, $repo)->shouldBeCalled();
     return $helper;
 }