/** * @group GH-1339 */ public function testRemoveDirectoryPhp() { @mkdir($this->workingDir . "/level1/level2", 0777, true); file_put_contents($this->workingDir . "/level1/level2/hello.txt", "hello world"); $fs = new Filesystem(); $this->assertTrue($fs->removeDirectoryPhp($this->workingDir)); $this->assertFalse(file_exists($this->workingDir . "/level1/level2/hello.txt")); }
protected function tearDown() { $fs = new Filesystem(); $dirs = glob(__DIR__ . '/../_fixtures/*/*/vendor'); foreach ($dirs as $dir) { $fs->removeDirectoryPhp($dir); } }
/** * @group GH-1339 */ public function testRemoveDirectoryPhp() { $tmp = sys_get_temp_dir(); @mkdir($tmp . "/composer_testdir/level1/level2", 0777, true); file_put_contents($tmp . "/composer_testdir/level1/level2/hello.txt", "hello world"); $fs = new Filesystem(); $this->assertTrue($fs->removeDirectoryPhp($tmp . "/composer_testdir")); $this->assertFalse(file_exists($tmp . "/composer_testdir/level1/level2/hello.txt")); }
/** * Remove directories / files that should not be copied */ protected function cleanTempDir() { foreach ($this->filesToIgnore as $fileToIgnore) { $this->fileSystem->unlink($this->rubedoRootDir . '/' . $fileToIgnore); } foreach ($this->dirsToIgnore as $dirToIgnore) { $this->fileSystem->removeDirectoryPhp($this->rubedoRootDir . '/' . $dirToIgnore); } }