From 836986faf3bfefeada469303aa5fca25bd670a01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Thu, 10 Oct 2013 22:57:03 +0200 Subject: [PATCH] Add temp composer home for GitDriver test using cache --- tests/Composer/Test/Repository/VcsRepositoryTest.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/Composer/Test/Repository/VcsRepositoryTest.php b/tests/Composer/Test/Repository/VcsRepositoryTest.php index b98be6fc2..eaedc82a9 100644 --- a/tests/Composer/Test/Repository/VcsRepositoryTest.php +++ b/tests/Composer/Test/Repository/VcsRepositoryTest.php @@ -25,12 +25,14 @@ use Composer\Config; */ class VcsRepositoryTest extends \PHPUnit_Framework_TestCase { + private static $composerHome; private static $gitRepo; private $skipped; protected function initialize() { $oldCwd = getcwd(); + self::$composerHome = sys_get_temp_dir() . '/composer-home-'.mt_rand().'/'; self::$gitRepo = sys_get_temp_dir() . '/composer-git-'.mt_rand().'/'; $locator = new ExecutableFinder(); @@ -125,6 +127,7 @@ class VcsRepositoryTest extends \PHPUnit_Framework_TestCase public static function tearDownAfterClass() { $fs = new Filesystem; + $fs->removeDirectory(self::$composerHome); $fs->removeDirectory(self::$gitRepo); } @@ -140,7 +143,13 @@ class VcsRepositoryTest extends \PHPUnit_Framework_TestCase 'dev-master' => true, ); - $repo = new VcsRepository(array('url' => self::$gitRepo, 'type' => 'vcs'), new NullIO, new Config()); + $config = new Config(); + $config->merge(array( + 'config' => array( + 'home' => self::$composerHome, + ), + )); + $repo = new VcsRepository(array('url' => self::$gitRepo, 'type' => 'vcs'), new NullIO, $config); $packages = $repo->getPackages(); $dumper = new ArrayDumper();