Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 11a676d

Browse filesBrowse files
committed
[Filesystem] Added unit tests for mirror method.
1 parent 8c94069 commit 11a676d
Copy full SHA for 11a676d

File tree

1 file changed

+22
-0
lines changed
Filter options

1 file changed

+22
-0
lines changed

‎src/Symfony/Component/Filesystem/Tests/FilesystemTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
+22Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,28 @@ public function providePathsForMakePathRelative()
441441
return $paths;
442442
}
443443

444+
public function testMirrorCopiesFilesAndDirectoriesRecursively()
445+
{
446+
$sourcePath = $this->workspace.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR;
447+
$directory = $sourcePath.'directory'.DIRECTORY_SEPARATOR;
448+
$file1 = $directory.'file1';
449+
$file2 = $sourcePath.'file2';
450+
451+
mkdir($sourcePath);
452+
mkdir($directory);
453+
file_put_contents($file1, 'FILE1');
454+
file_put_contents($file2, 'FILE2');
455+
456+
$targetPath = $this->workspace.DIRECTORY_SEPARATOR.'target'.DIRECTORY_SEPARATOR;
457+
458+
$this->filesystem->mirror($sourcePath, $targetPath);
459+
460+
$this->assertTrue(is_dir($targetPath));
461+
$this->assertTrue(is_dir($targetPath.'directory'));
462+
$this->assertFileEquals($file1, $targetPath.'directory'.DIRECTORY_SEPARATOR.'file1');
463+
$this->assertFileEquals($file2, $targetPath.'file2');
464+
}
465+
444466
/**
445467
* @dataProvider providePathsForIsAbsolutePath
446468
*/

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.