From 4af69c85ca9401cc07eb73a7ba8c7fd26fe4920e Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Thu, 28 Mar 2013 13:21:55 +0100 Subject: [PATCH] Fix tests by passing proper working directory to processes --- tests/Composer/Test/AllFunctionalTest.php | 5 ++--- tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php | 5 +++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/Composer/Test/AllFunctionalTest.php b/tests/Composer/Test/AllFunctionalTest.php index 83f530f75..915804f33 100644 --- a/tests/Composer/Test/AllFunctionalTest.php +++ b/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'])) { diff --git a/tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php b/tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php index 16b315038..2c51461ed 100644 --- a/tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php +++ b/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());