Inheritance: extends Symfony\Component\Console\Helper\Helper
Beispiel #1
0
    public function testRemoteBranchExistsException()
    {
        $remote = 'phansys';
        $sourceBranch = 'my-feat-10';
        $remoteList = <<<'EOL'
8b64e4ecb74f2d2df582c0ab03a5c1ae890c43fb	HEAD
299aaa49cc5e1de3382c77d901736dcfd909d681	refs/heads/0.1
2ef49b196a50f481a4547b02817d9ee08dd8a0d4	refs/heads/0.2
d152871fd334619019df578a407b83ccb2c93ed7	refs/heads/0.3
5a7dbfd02ca80d5122827da832c579b116c29547	refs/heads/1.0
ae9c5ee4509cc5c141e5fd9d70c083936dc9a108	refs/heads/2.0
48e2a3a490abcad8e484d9189f001e9a222a48da	refs/heads/my-feat-10
b735c63268579326c3187e7a21ea46947b12a163	refs/heads/my-feat
538b6ba0a3b9943641657c30f9eea702bbe3b6dd	refs/heads/my-feat-1
bb590a7055e6338943346f9c445f298d89fb9ce9	refs/heads/my-feat-10
144c0c98ab5d216f4b208cf702838357d3fdb811	refs/heads/my-feat-100
704a8bc7030da0dd56f17fd8c736e620c26c42ef	refs/heads/my-feat-1001
ce8bafdd18a5d1753d7a9872d3f402657873f249	refs/heads/new-my-feat-10
70cc7f22e4d937621dee3bbbb79b2913f6037137	refs/heads/my-feat-2
611fedc6cc77fd9a0c0b96eadce375cb28937204	refs/heads/my-feat-200
eafa079bb55453b44fe02b98f7420703c532b849	refs/heads/my-feat-2000
EOL;
        $processHelper = $this->prophesize(ProcessHelper::class);
        $this->unitGit = new GitHelper($processHelper->reveal(), $this->gitConfigHelper->reveal(), $this->filesystemHelper->reveal());
        $processHelper->runCommand(['git', 'ls-remote', $remote], true)->willReturn($remoteList);
        $this->setExpectedException('\\RuntimeException', sprintf('Invalid refs found while searching for remote branch at "refs/heads/%s"', $sourceBranch));
        $this->assertTrue($this->unitGit->remoteBranchExists($remote, $sourceBranch));
    }
Beispiel #2
0
 /**
  * @test
  */
 public function merges_remote_branch_fast_forward_in_clean_wc()
 {
     $base = 'master';
     $sourceBranch = 'amazing-feature';
     $processHelper = $this->prophesize('Gush\\Helper\\ProcessHelper');
     $this->unitGit = new GitHelper($processHelper->reveal(), $this->gitConfigHelper->reveal(), $this->filesystemHelper->reveal());
     $processHelper->runCommand('git status --porcelain --untracked-files=no')->willReturn("\n");
     $processHelper->runCommand('git rev-parse --abbrev-ref HEAD')->willReturn('master');
     $processHelper->runCommand(['git', 'checkout', 'master'])->shouldBeCalled();
     $processHelper->runCommand(['git', 'merge', '--ff', 'amazing-feature'])->shouldBeCalled();
     $this->assertNull($this->unitGit->mergeBranch($base, $sourceBranch, null, true));
 }
Beispiel #3
0
 /**
  * @test
  * @dataProvider repoUrlProvider
  */
 public function gets_information_about_the_remote($url, array $expectedInfo)
 {
     $this->processHelper->expects($this->atLeastOnce())->method('runCommand')->with($this->equalTo('git config --local --get remote.origin.url'))->will($this->returnValue($url));
     $this->assertEquals($expectedInfo, $this->gitConfigHelper->getRemoteInfo('origin'));
 }