1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-09 00:22:53 +00:00

try to use unique test directories

any tests that use the filesystem should have their own unique directory, as we run our test suite in parallel and
cleanup of tests (removing directories) should not interfere with currently running tests
This commit is contained in:
Rob Bast 2016-01-21 13:01:55 +01:00
parent 06a21132db
commit adf3b956d0
25 changed files with 145 additions and 91 deletions

View file

@ -14,9 +14,10 @@ namespace Composer\Test\Downloader;
use Composer\Downloader\GitDownloader;
use Composer\Config;
use Composer\TestCase;
use Composer\Util\Filesystem;
class GitDownloaderTest extends \PHPUnit_Framework_TestCase
class GitDownloaderTest extends TestCase
{
/** @var Filesystem */
private $fs;
@ -26,7 +27,7 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
$this->fs = new Filesystem;
$this->workingDir = realpath(sys_get_temp_dir()).DIRECTORY_SEPARATOR.'cmptest-'.md5(uniqid('', true));
$this->workingDir = $this->getUniqueTmpDirectory();
}
protected function tearDown()
@ -317,7 +318,7 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase
->method('execute')
->with($this->equalTo($expectedGitUpdateCommand))
->will($this->returnValue(1));
$this->fs->ensureDirectoryExists($this->workingDir.'/.git');
$downloader = $this->getDownloaderMock(null, new Config(), $processExecutor);
$downloader->update($packageMock, $packageMock, $this->workingDir);