Exemple #1
0
 public function testProcess()
 {
     $process = $this->getMockBuilder('Symfony\\Component\\Process\\Process')->disableOriginalConstructor()->getMock();
     $process->expects($this->once())->method('getErrorOutput')->will($this->returnValue('error'));
     $process->expects($this->once())->method('getOutput')->will($this->returnValue('output'));
     $exception = GitException::process($process);
     $this->assertEquals('outputerror', $exception->getMessage());
 }
Exemple #2
0
 /**
  * Returns the current Git tag.
  *
  * @param null|string $path The repository path.
  *
  * @return string The tag.
  *
  * @throws GitException If there was an error using Git.
  */
 public function getTag($path = null)
 {
     $path = $this->resolvePath($path);
     $process = new Process('git describe --tags HEAD', $path);
     if (0 === $process->run()) {
         return trim($process->getOutput());
     }
     throw GitException::process($process);
 }