1
0
Fork 0

Fix tests by passing proper working directory to processes

pull/1567/head
Nils Adermann 2013-03-28 13:21:55 +01:00
parent 6f61d95829
commit 4af69c85ca
2 changed files with 5 additions and 5 deletions

View File

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

View File

@ -75,7 +75,8 @@ class ArchiveManagerTest extends ArchiverTest
$currentWorkDir = getcwd(); $currentWorkDir = getcwd();
chdir($this->testDir); 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) { if ($result > 0) {
chdir($currentWorkDir); chdir($currentWorkDir);
throw new \RuntimeException('Could not init: '.$this->process->getErrorOutput()); throw new \RuntimeException('Could not init: '.$this->process->getErrorOutput());
@ -87,7 +88,7 @@ class ArchiveManagerTest extends ArchiverTest
throw new \RuntimeException('Could not save file.'); 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) { if ($result > 0) {
chdir($currentWorkDir); chdir($currentWorkDir);
throw new \RuntimeException('Could not commit: '.$this->process->getErrorOutput()); throw new \RuntimeException('Could not commit: '.$this->process->getErrorOutput());