Ejemplo n.º 1
0
 public function testBranchExists()
 {
     $commandExecutor = new MockCommandExecutor(new MockCommandBuilder());
     $vcs = new GitVcs($commandExecutor);
     $meta = $vcs->getMeta();
     $this->assertInstanceOf('\\ptlis\\Vcs\\Interfaces\\MetaInterface', $meta);
 }
Ejemplo n.º 2
0
 public function testBranchExists()
 {
     $result = array(new ShellResult(0, '', ''), new ShellResult(0, '', ''), new ShellResult(0, '', ''));
     $mockExecutor = new MockCommandExecutor(new MockCommandBuilder($result, '/usr/bin/git'));
     $vcs = new GitVcs($mockExecutor);
     $vcs->update();
     $this->assertEquals(array(array('reset', '--hard'), array('fetch'), array('rebase')), $mockExecutor->getArguments());
 }
Ejemplo n.º 3
0
 public function testBranchDoesntExist()
 {
     $this->setExpectedException('\\RuntimeException', 'Branch named "feat-new-badness" not found.');
     $results = array(new ShellResult(0, '', ''));
     $commandExecutor = new MockCommandExecutor(new MockCommandBuilder($results, '/usr/bin/git'));
     $vcs = new GitVcs($commandExecutor);
     $vcs->changeBranch('feat-new-badness');
 }
Ejemplo n.º 4
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');
 }
Ejemplo n.º 5
0
 public function testNotRequired()
 {
     $result = array(new ShellResult(0, 'master' . PHP_EOL, ''));
     $mockExecutor = new MockCommandExecutor(new MockCommandBuilder($result, '/usr/bin/git'));
     $vcs = new GitVcs($mockExecutor);
     $vcs->resetRevision();
     $this->assertEquals(array(), $mockExecutor->getArguments());
 }