Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Circumvent cache in functional tests

  • Loading branch information...
commit 62d0ea765687e0d2ffb8c495284e616aa4e906c6 1 parent 374e16b
@Seldaek Seldaek authored
Showing with 11 additions and 7 deletions.
  1. +11 −7 tests/Composer/Test/AllFunctionalTest.php
View
18 tests/Composer/Test/AllFunctionalTest.php
@@ -12,6 +12,7 @@
class AllFunctionalTest extends \PHPUnit_Framework_TestCase
{
protected $oldcwd;
+ protected $oldenv;
protected $testDir;
public function setUp()
@@ -23,11 +24,17 @@ public function setUp()
public function tearDown()
{
chdir($this->oldcwd);
+ $fs = new Filesystem;
if ($this->testDir) {
- $fs = new Filesystem;
$fs->removeDirectory($this->testDir);
$this->testDir = null;
}
+ if ($this->oldenv) {
+ $fs->removeDirectory(getenv('COMPOSER_HOME'));
+ putenv('COMPOSER_HOME='.$this->oldenv);
+ $this->oldenv = null;
+ }
+
}
/**
@@ -37,6 +44,9 @@ public function testIntegration(\SplFileInfo $testFile)
{
$testData = $this->parseTestFile($testFile);
+ $this->oldenv = getenv('COMPOSER_HOME');
+ putenv('COMPOSER_HOME='.$this->testDir.'home');
+
$cmd = 'php '.__DIR__.'/../../../bin/composer --no-ansi '.$testData['RUN'];
$proc = new Process($cmd);
$exitcode = $proc->run();
@@ -56,12 +66,6 @@ public function testIntegration(\SplFileInfo $testFile)
if (isset($testData['EXPECT-EXIT-CODE'])) {
$this->assertSame($testData['EXPECT-EXIT-CODE'], $exitcode);
}
-
- // Clean up.
- $fs = new Filesystem();
- if (isset($testData['test_dir']) && is_dir($testData['test_dir'])) {
- $fs->removeDirectory($testData['test_dir']);
- }
}
public function getTestFiles()
Please sign in to comment.
Something went wrong with that request. Please try again.