Beispiel #1
0
 public function testNotFound()
 {
     $this->setExpectedException('\\RuntimeException', 'Revision "bob" not found.');
     $results = array(new ShellResult(0, 'fatal: ambiguous argument \'bob\': unknown revision or path not in the working tree.' . PHP_EOL . 'Use \'--\' to separate paths from revisions, like this:' . PHP_EOL . '\'git <command> [<revision>...] -- [<file>...]\'' . PHP_EOL, ''));
     $mockExecutor = new MockCommandExecutor(new MockCommandBuilder($results, '/usr/bin/git'));
     $vcs = new GitVcs($mockExecutor);
     $vcs->checkoutRevision('bob');
 }
Beispiel #2
0
 public function testSuccess()
 {
     $result = array(new ShellResult(0, file_get_contents(realpath(__DIR__ . '/data/git_log')), ''), new ShellResult(0, 'master' . PHP_EOL, ''), new ShellResult(0, 'Switched to a new branch \'ptlis-vcs-temp\'' . PHP_EOL, ''), new ShellResult(0, 'On branch master' . PHP_EOL . 'Your branch is ahead of \'origin/master\' by 5 commits.' . PHP_EOL . '  (use "git push" to publish your local commits)' . PHP_EOL, ''), new ShellResult(0, 'Deleted branch ptlis-vcs-temp (was 3201fb7)' . PHP_EOL, ''));
     $mockExecutor = new MockCommandExecutor(new MockCommandBuilder($result, '/usr/bin/git'));
     $vcs = new GitVcs($mockExecutor);
     $vcs->checkoutRevision('3201fb7119a132cc65b368447310c3a64e0b0916');
     $vcs->resetRevision();
     $this->assertEquals(array(array('log', '--format=fuller', '-1', '3201fb7119a132cc65b368447310c3a64e0b0916'), array('rev-parse', '--abbrev-ref', 'HEAD'), array('checkout', '-b', 'ptlis-vcs-temp', '3201fb7119a132cc65b368447310c3a64e0b0916'), array('checkout', 'master'), array('branch', '-d', 'ptlis-vcs-temp')), $mockExecutor->getArguments());
 }