Browse Source

Show warning if the svn binary is missing

Jordi Boggiano 12 years ago
parent
commit
4998bab944

+ 4 - 0
src/Composer/Repository/Vcs/SvnDriver.php

@@ -270,6 +270,10 @@ class SvnDriver extends VcsDriver
         try {
             return $this->util->execute($command, $url);
         } catch (\RuntimeException $e) {
+            if (0 !== $this->process->execute('svn --version', $ignoredOutput)) {
+                throw new \RuntimeException('Failed to load '.$this->url.', svn was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput());
+            }
+
             throw new \RuntimeException(
                 'Repository '.$this->url.' could not be processed, '.$e->getMessage()
             );

+ 4 - 1
tests/Composer/Test/Repository/Vcs/SvnDriverTest.php

@@ -32,12 +32,15 @@ class SvnDriverTest extends \PHPUnit_Framework_TestCase
         $output .= " rejected Basic challenge (http://corp.svn.local/)";
 
         $process = $this->getMock('Composer\Util\ProcessExecutor');
-        $process->expects($this->once())
+        $process->expects($this->at(1))
             ->method('execute')
             ->will($this->returnValue(1));
         $process->expects($this->once())
             ->method('getErrorOutput')
             ->will($this->returnValue($output));
+        $process->expects($this->at(2))
+            ->method('execute')
+            ->will($this->returnValue(0));
 
         $config = new Config();
         $config->merge(array(