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->fs = new Filesystem;
$this->workingDir = realpath(sys_get_temp_dir()).DIRECTORY_SEPARATOR.'cmptest-'.md5(uniqid('', true)); $this->workingDir = realpath(sys_get_temp_dir()).DIRECTORY_SEPARATOR.'cmptest-'.md5(uniqid('', true));
$this->fs->ensureDirectoryExists($this->workingDir);
} }
protected function tearDown() protected function tearDown()

@ -17,22 +17,19 @@ use Composer\Util\Filesystem;
class HgDownloaderTest extends \PHPUnit_Framework_TestCase class HgDownloaderTest extends \PHPUnit_Framework_TestCase
{ {
/** @var Filesystem */
private $fs;
/** @var string */ /** @var string */
private $workingDir; private $workingDir;
protected function setUp() protected function setUp()
{ {
$this->fs = new Filesystem;
$this->workingDir = realpath(sys_get_temp_dir()).DIRECTORY_SEPARATOR.'cmptest-'.md5(uniqid('', true)); $this->workingDir = realpath(sys_get_temp_dir()).DIRECTORY_SEPARATOR.'cmptest-'.md5(uniqid('', true));
$this->fs->ensureDirectoryExists($this->workingDir);
} }
protected function tearDown() protected function tearDown()
{ {
if (is_dir($this->workingDir)) { 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 $repoConfig;
protected $repository; protected $repository;
protected $testPath; protected $testPath;
protected $fs;
protected function setUp() protected function setUp()
{ {
$this->fs = new Filesystem;
$this->testPath = sys_get_temp_dir() . '/composer-test'; $this->testPath = sys_get_temp_dir() . '/composer-test';
$this->fs->ensureDirectoryExists($this->testPath);
$this->repoConfig = $this->getRepoConfig(); $this->repoConfig = $this->getRepoConfig();
$this->config = $this->getConfig(); $this->config = $this->getConfig();
$this->io = $this->getMockIoInterface(); $this->io = $this->getMockIoInterface();
@ -56,7 +53,8 @@ class PerforceDownloaderTest extends \PHPUnit_Framework_TestCase
$this->config = null; $this->config = null;
$this->repoConfig = null; $this->repoConfig = null;
if (is_dir($this->testPath)) { 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')) { if (defined('PHP_WINDOWS_VERSION_BUILD')) {
$this->markTestSkipped('Skip test on Windows'); $this->markTestSkipped('Skip test on Windows');
} }
$this->fs = new Filesystem;
$this->testName = sys_get_temp_dir().'/composer-xz-test-vendor'; $this->testName = sys_get_temp_dir().'/composer-xz-test-vendor';
} }
public function tearDown() public function tearDown()
{ {
$this->fs = new Filesystem;
$this->fs->removeDirectory($this->testName); $this->fs->removeDirectory($this->testName);
} }

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

Loading…
Cancel
Save