Skip to content

Commit

Permalink
Remove unnescessary code
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthony MARTIN committed Feb 22, 2019
1 parent 3743a5b commit 785dc05
Showing 1 changed file with 1 addition and 41 deletions.
42 changes: 1 addition & 41 deletions src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
Expand Up @@ -1348,46 +1348,6 @@ public function testMirrorContentsWithSameNameAsSourceOrTargetWithDeleteOption()
$this->assertFileNotExists($targetPath.'target');
}

public function testMirrorWithCustomIterator()
{
$sourcePath = $this->workspace.\DIRECTORY_SEPARATOR.'source'.\DIRECTORY_SEPARATOR;
mkdir($sourcePath);

$file = $sourcePath.\DIRECTORY_SEPARATOR.'file';
file_put_contents($file, 'FILE');

$targetPath = $this->workspace.\DIRECTORY_SEPARATOR.'target'.\DIRECTORY_SEPARATOR;

$splFile = new \SplFileInfo($file);
$iterator = new \ArrayObject([$splFile]);

$this->filesystem->mirror($sourcePath, $targetPath, $iterator);

$this->assertTrue(is_dir($targetPath));
$this->assertFileEquals($file, $targetPath.\DIRECTORY_SEPARATOR.'file');
}

/**
* @expectedException \Symfony\Component\Filesystem\Exception\IOException
* @expectedExceptionMessageRegExp /Unable to mirror "(.*)" directory/
*/
public function testMirrorWithCustomIteratorWithRelativePath()
{
$sourcePath = $this->workspace.\DIRECTORY_SEPARATOR.'source'.\DIRECTORY_SEPARATOR.'..'.\DIRECTORY_SEPARATOR.'source'.\DIRECTORY_SEPARATOR;
$realSourcePath = $this->workspace.\DIRECTORY_SEPARATOR.'source'.\DIRECTORY_SEPARATOR;
mkdir($realSourcePath);

$file = $realSourcePath.'file';
file_put_contents($file, 'FILE');

$targetPath = $this->workspace.\DIRECTORY_SEPARATOR.'target'.\DIRECTORY_SEPARATOR.'..'.\DIRECTORY_SEPARATOR.'target'.\DIRECTORY_SEPARATOR;

$splFile = new \SplFileInfo($file);
$iterator = new \ArrayObject([$splFile]);

$this->filesystem->mirror($sourcePath, $targetPath, $iterator);
}

public function testMirrorAvoidCopyingTargetDirectoryIfInSourceDirectory()
{
$sourcePath = $this->workspace.\DIRECTORY_SEPARATOR.'source'.\DIRECTORY_SEPARATOR;
Expand All @@ -1410,7 +1370,7 @@ public function testMirrorAvoidCopyingTargetDirectoryIfInSourceDirectory()
$this->assertFileEquals($file1, $targetPath.'directory'.\DIRECTORY_SEPARATOR.'file1');
$this->assertFileEquals($file2, $targetPath.'file2');

$this->assertFileNotExists($targetPath.'target');
$this->assertFalse(is_dir($targetPath.'target'));
}

/**
Expand Down

0 comments on commit 785dc05

Please sign in to comment.