/**
  * fetch test
  */
 public function testFetch()
 {
     $fc = FetchCommand::getInstance();
     $this->assertEquals("fetch", $fc->fetch());
     $this->assertEquals("fetch 'github'", $fc->fetch('github'));
     $this->assertEquals("fetch 'github' 'develop'", $fc->fetch('github', 'develop'));
     $this->getRepository()->addRemote('test-remote', 'git@github.com:matteosister/GitElephant.git');
     $remote = m::mock('GitElephant\\Objects\\Remote')->shouldReceive('getName')->andReturn('test-remote')->getMock();
     $this->assertEquals("fetch 'test-remote' 'develop'", $fc->fetch($remote, 'develop'));
     $branch = Branch::create($this->getRepository(), 'test-branch');
     $this->assertEquals("fetch 'test-remote' 'test-branch'", $fc->fetch($remote, $branch));
     $this->assertEquals("fetch '--tags' 'test-remote' 'test-branch'", $fc->fetch($remote, $branch, array('--tags')));
 }
Beispiel #2
0
 /**
  * Download objects and refs from another repository
  *
  * @param string $from
  * @param string $ref
  * @param bool   $tags
  *
  * @throws \RuntimeException
  * @throws \Symfony\Component\Process\Exception\LogicException
  * @throws \Symfony\Component\Process\Exception\InvalidArgumentException
  * @throws \Symfony\Component\Process\Exception\RuntimeException
  */
 public function fetch($from = null, $ref = null, $tags = false)
 {
     $options = array();
     if ($tags === true) {
         $options = array('--tags');
     }
     $this->caller->execute(FetchCommand::getInstance($this)->fetch($from, $ref, $options));
 }