Tests should remove created directories after testing process
parent
773338a688
commit
8d3b40ff8e
|
@ -23,18 +23,18 @@ class AutoloadGeneratorTest extends \PHPUnit_Framework_TestCase
|
|||
private $im;
|
||||
private $repository;
|
||||
private $generator;
|
||||
private $fs;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$fs = new Filesystem;
|
||||
$this->fs = new Filesystem;
|
||||
$that = $this;
|
||||
|
||||
$this->workingDir = realpath(sys_get_temp_dir());
|
||||
$this->vendorDir = $this->workingDir.DIRECTORY_SEPARATOR.'composer-test-autoload';
|
||||
if (is_dir($this->vendorDir)) {
|
||||
$fs->removeDirectory($this->vendorDir);
|
||||
if (!is_dir($this->vendorDir)) {
|
||||
mkdir($this->vendorDir);
|
||||
}
|
||||
mkdir($this->vendorDir);
|
||||
|
||||
$this->dir = getcwd();
|
||||
chdir($this->workingDir);
|
||||
|
@ -60,6 +60,9 @@ class AutoloadGeneratorTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
protected function tearDown()
|
||||
{
|
||||
if (is_dir($this->vendorDir)) {
|
||||
$this->fs->removeDirectory($this->vendorDir);
|
||||
}
|
||||
chdir($this->dir);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,16 +30,15 @@ class LibraryInstallerTest extends \PHPUnit_Framework_TestCase
|
|||
$this->fs = new Filesystem;
|
||||
|
||||
$this->vendorDir = realpath(sys_get_temp_dir()).DIRECTORY_SEPARATOR.'composer-test-vendor';
|
||||
if (is_dir($this->vendorDir)) {
|
||||
$this->fs->removeDirectory($this->vendorDir);
|
||||
if (!is_dir($this->vendorDir)) {
|
||||
mkdir($this->vendorDir);
|
||||
}
|
||||
mkdir($this->vendorDir);
|
||||
|
||||
|
||||
$this->binDir = realpath(sys_get_temp_dir()).DIRECTORY_SEPARATOR.'composer-test-bin';
|
||||
if (is_dir($this->binDir)) {
|
||||
$this->fs->removeDirectory($this->binDir);
|
||||
if (!is_dir($this->binDir)) {
|
||||
mkdir($this->binDir);
|
||||
}
|
||||
mkdir($this->binDir);
|
||||
|
||||
$this->dm = $this->getMockBuilder('Composer\Downloader\DownloadManager')
|
||||
->disableOriginalConstructor()
|
||||
|
@ -52,6 +51,16 @@ class LibraryInstallerTest extends \PHPUnit_Framework_TestCase
|
|||
->getMock();
|
||||
}
|
||||
|
||||
protected function tearDown() {
|
||||
if (is_dir($this->vendorDir)) {
|
||||
$this->fs->removeDirectory($this->vendorDir);
|
||||
}
|
||||
|
||||
if (is_dir($this->binDir)) {
|
||||
$this->fs->removeDirectory($this->binDir);
|
||||
}
|
||||
}
|
||||
|
||||
public function testInstallerCreationShouldNotCreateVendorDirectory()
|
||||
{
|
||||
$this->fs->removeDirectory($this->vendorDir);
|
||||
|
|
Loading…
Reference in New Issue