Add temp composer home for GitDriver test using cache

main
Jérôme Tamarelle 11 years ago
parent f51aa4fad6
commit 836986faf3

@ -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();

Loading…
Cancel
Save