diff --git a/tests/Composer/Test/Downloader/GitDownloaderTest.php b/tests/Composer/Test/Downloader/GitDownloaderTest.php index 75b5ab46c..f0b6699e5 100644 --- a/tests/Composer/Test/Downloader/GitDownloaderTest.php +++ b/tests/Composer/Test/Downloader/GitDownloaderTest.php @@ -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() diff --git a/tests/Composer/Test/Downloader/HgDownloaderTest.php b/tests/Composer/Test/Downloader/HgDownloaderTest.php index 504f9d2c4..b2dee627b 100644 --- a/tests/Composer/Test/Downloader/HgDownloaderTest.php +++ b/tests/Composer/Test/Downloader/HgDownloaderTest.php @@ -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); } } diff --git a/tests/Composer/Test/Downloader/PerforceDownloaderTest.php b/tests/Composer/Test/Downloader/PerforceDownloaderTest.php index 2e01ddee2..fc4297633 100644 --- a/tests/Composer/Test/Downloader/PerforceDownloaderTest.php +++ b/tests/Composer/Test/Downloader/PerforceDownloaderTest.php @@ -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); } } diff --git a/tests/Composer/Test/Downloader/XzDownloaderTest.php b/tests/Composer/Test/Downloader/XzDownloaderTest.php index 900975694..2acc7b4d0 100644 --- a/tests/Composer/Test/Downloader/XzDownloaderTest.php +++ b/tests/Composer/Test/Downloader/XzDownloaderTest.php @@ -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); } diff --git a/tests/Composer/Test/Downloader/ZipDownloaderTest.php b/tests/Composer/Test/Downloader/ZipDownloaderTest.php index b50072084..25a95ace6 100644 --- a/tests/Composer/Test/Downloader/ZipDownloaderTest.php +++ b/tests/Composer/Test/Downloader/ZipDownloaderTest.php @@ -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 {