Fixed case for empty folder
This commit is contained in:
parent
08bebaba2c
commit
5321741ab5
|
@ -388,6 +388,10 @@ class Filesystem
|
|||
$iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($originDir, $flags), \RecursiveIteratorIterator::SELF_FIRST);
|
||||
}
|
||||
|
||||
if ($this->exists($originDir)) {
|
||||
$this->mkdir($targetDir);
|
||||
}
|
||||
|
||||
foreach ($iterator as $file) {
|
||||
$target = str_replace($originDir, $targetDir, $file->getPathname());
|
||||
|
||||
|
|
|
@ -845,6 +845,21 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertFalse($this->filesystem->exists($targetPath.'directory'.DIRECTORY_SEPARATOR.'file1'));
|
||||
}
|
||||
|
||||
public function testMirrorCreatesEmptyDirectory()
|
||||
{
|
||||
$sourcePath = $this->workspace.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR;
|
||||
|
||||
mkdir($sourcePath);
|
||||
|
||||
$targetPath = $this->workspace.DIRECTORY_SEPARATOR.'target'.DIRECTORY_SEPARATOR;
|
||||
|
||||
$this->filesystem->mirror($sourcePath, $targetPath);
|
||||
|
||||
$this->assertTrue(is_dir($targetPath));
|
||||
|
||||
$this->filesystem->remove($sourcePath);
|
||||
}
|
||||
|
||||
public function testMirrorCopiesLinks()
|
||||
{
|
||||
$this->markAsSkippedIfSymlinkIsMissing();
|
||||
|
|
Reference in New Issue