Просмотр исходного кода

Fix tests by passing proper working directory to processes

Nils Adermann 12 лет назад
Родитель
Сommit
4af69c85ca

+ 2 - 3
tests/Composer/Test/AllFunctionalTest.php

@@ -55,9 +55,8 @@ class AllFunctionalTest extends \PHPUnit_Framework_TestCase
         $fs->ensureDirectoryExists(dirname(self::$pharPath));
         chdir(dirname(self::$pharPath));
 
-        $proc = new Process('php '.escapeshellarg(__DIR__.'/../../../bin/compile'));
+        $proc = new Process('php '.escapeshellarg(__DIR__.'/../../../bin/compile'), dirname(self::$pharPath));
         $exitcode = $proc->run();
-
         if ($exitcode !== 0 || trim($proc->getOutput())) {
             $this->fail($proc->getOutput());
         }
@@ -76,7 +75,7 @@ class AllFunctionalTest extends \PHPUnit_Framework_TestCase
         putenv('COMPOSER_HOME='.$this->testDir.'home');
 
         $cmd = 'php '.escapeshellarg(self::$pharPath).' --no-ansi '.$testData['RUN'];
-        $proc = new Process($cmd);
+        $proc = new Process($cmd, __DIR__.'/Fixtures/functional');
         $exitcode = $proc->run();
 
         if (isset($testData['EXPECT'])) {

+ 3 - 2
tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php

@@ -75,7 +75,8 @@ class ArchiveManagerTest extends ArchiverTest
         $currentWorkDir = getcwd();
         chdir($this->testDir);
 
-        $result = $this->process->execute('git init -q');
+        $output = null;
+        $result = $this->process->execute('git init -q', $output, $this->testDir);
         if ($result > 0) {
             chdir($currentWorkDir);
             throw new \RuntimeException('Could not init: '.$this->process->getErrorOutput());
@@ -87,7 +88,7 @@ class ArchiveManagerTest extends ArchiverTest
             throw new \RuntimeException('Could not save file.');
         }
 
-        $result = $this->process->execute('git add b && git commit -m "commit b" -q');
+        $result = $this->process->execute('git add b && git commit -m "commit b" -q', $output, $this->testDir);
         if ($result > 0) {
             chdir($currentWorkDir);
             throw new \RuntimeException('Could not commit: '.$this->process->getErrorOutput());