review fixes

main
Alexander Loutsenko 9 years ago
parent fa5de786ff
commit 397ae2d7c8

@ -27,7 +27,6 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase
{
$this->fs = new Filesystem;
$this->workingDir = realpath(sys_get_temp_dir()).DIRECTORY_SEPARATOR.'cmptest-'.md5(uniqid('', true));
$this->fs->ensureDirectoryExists($this->workingDir);
}
protected function tearDown()

@ -17,22 +17,19 @@ use Composer\Util\Filesystem;
class HgDownloaderTest extends \PHPUnit_Framework_TestCase
{
/** @var Filesystem */
private $fs;
/** @var string */
private $workingDir;
protected function setUp()
{
$this->fs = new Filesystem;
$this->workingDir = realpath(sys_get_temp_dir()).DIRECTORY_SEPARATOR.'cmptest-'.md5(uniqid('', true));
$this->fs->ensureDirectoryExists($this->workingDir);
}
protected function tearDown()
{
if (is_dir($this->workingDir)) {
$this->fs->removeDirectory($this->workingDir);
$fs = new Filesystem;
$fs->removeDirectory($this->workingDir);
}
}

@ -31,13 +31,10 @@ class PerforceDownloaderTest extends \PHPUnit_Framework_TestCase
protected $repoConfig;
protected $repository;
protected $testPath;
protected $fs;
protected function setUp()
{
$this->fs = new Filesystem;
$this->testPath = sys_get_temp_dir() . '/composer-test';
$this->fs->ensureDirectoryExists($this->testPath);
$this->repoConfig = $this->getRepoConfig();
$this->config = $this->getConfig();
$this->io = $this->getMockIoInterface();
@ -56,7 +53,8 @@ class PerforceDownloaderTest extends \PHPUnit_Framework_TestCase
$this->config = null;
$this->repoConfig = null;
if (is_dir($this->testPath)) {
$this->fs->removeDirectory($this->testPath);
$fs = new Filesystem;
$fs->removeDirectory($this->testPath);
}
}

@ -32,12 +32,12 @@ class XzDownloaderTest extends \PHPUnit_Framework_TestCase
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
$this->markTestSkipped('Skip test on Windows');
}
$this->fs = new Filesystem;
$this->testName = sys_get_temp_dir().'/composer-xz-test-vendor';
}
public function tearDown()
{
$this->fs = new Filesystem;
$this->fs->removeDirectory($this->testName);
}

@ -17,28 +17,24 @@ use Composer\Util\Filesystem;
class ZipDownloaderTest extends \PHPUnit_Framework_TestCase
{
/**
* @var Filesystem
*/
private $fs;
/**
* @var string
*/
private $testName;
private $testDir;
public function setUp()
{
if (!class_exists('ZipArchive')) {
$this->markTestSkipped('zip extension missing');
}
$this->fs = new Filesystem;
$this->testName = sys_get_temp_dir().'/composer-zip-test-vendor';
$this->testDir = sys_get_temp_dir().'/composer-zip-test-vendor';
}
public function tearDown()
{
$this->fs->removeDirectory($this->testName);
$fs = new Filesystem;
$fs->removeDirectory($this->testDir);
}
public function testErrorMessages()
@ -62,7 +58,7 @@ class ZipDownloaderTest extends \PHPUnit_Framework_TestCase
$config->expects($this->any())
->method('get')
->with('vendor-dir')
->will($this->returnValue($this->testName));
->will($this->returnValue($this->testDir));
$downloader = new ZipDownloader($io, $config);
try {

Loading…
Cancel
Save