Browse Source

Add temp composer home for GitDriver test using cache

Jérôme Tamarelle 11 years ago
parent
commit
836986faf3
1 changed files with 10 additions and 1 deletions
  1. 10 1
      tests/Composer/Test/Repository/VcsRepositoryTest.php

+ 10 - 1
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();