@@ -1065,6 +1065,48 @@ public function testMirrorContentsWithSameNameAsSourceOrTargetWithDeleteOption()
1065
1065
$ this ->assertFileNotExists ($ targetPath .'target ' );
1066
1066
}
1067
1067
1068
+ public function testMirrorWithCustomIterator ()
1069
+ {
1070
+ $ sourcePath = $ this ->workspace .DIRECTORY_SEPARATOR .'source ' .DIRECTORY_SEPARATOR ;
1071
+ mkdir ($ sourcePath );
1072
+
1073
+ $ file = $ sourcePath .DIRECTORY_SEPARATOR .'file ' ;
1074
+ file_put_contents ($ file , 'FILE ' );
1075
+
1076
+ $ targetPath = $ this ->workspace .DIRECTORY_SEPARATOR .'target ' .DIRECTORY_SEPARATOR ;
1077
+
1078
+ $ splFile = new \SplFileInfo ($ file );
1079
+ $ iterator = new \ArrayObject (array ($ splFile ));
1080
+
1081
+ $ this ->filesystem ->mirror ($ sourcePath , $ targetPath , $ iterator );
1082
+
1083
+ $ this ->assertTrue (is_dir ($ targetPath ));
1084
+ $ this ->assertFileEquals ($ file , $ targetPath .DIRECTORY_SEPARATOR .'file ' );
1085
+ }
1086
+
1087
+ public function testMirrorWithCustomIteratorWithRelativePath ()
1088
+ {
1089
+ $ sourcePath = $ this ->workspace .DIRECTORY_SEPARATOR .'source ' .DIRECTORY_SEPARATOR .'.. ' .DIRECTORY_SEPARATOR .'source ' .DIRECTORY_SEPARATOR ;
1090
+ $ realSourcePath = $ this ->workspace .DIRECTORY_SEPARATOR .'source ' .DIRECTORY_SEPARATOR ;
1091
+ mkdir ($ realSourcePath );
1092
+
1093
+ $ file = $ realSourcePath .'file ' ;
1094
+ file_put_contents ($ file , 'FILE ' );
1095
+
1096
+ $ targetPath = $ this ->workspace .DIRECTORY_SEPARATOR .'target ' .DIRECTORY_SEPARATOR .'.. ' .DIRECTORY_SEPARATOR .'target ' .DIRECTORY_SEPARATOR ;
1097
+ $ realTargetPath = $ this ->workspace .DIRECTORY_SEPARATOR .'target ' .DIRECTORY_SEPARATOR ;
1098
+
1099
+ $ splFile = new \SplFileInfo ($ file );
1100
+ $ iterator = new \ArrayObject (array ($ splFile ));
1101
+
1102
+ $ this ->filesystem ->mirror ($ sourcePath , $ targetPath , $ iterator );
1103
+
1104
+ $ this ->assertTrue (is_dir ($ targetPath ));
1105
+ $ this ->assertTrue (is_dir ($ realTargetPath ));
1106
+ $ this ->assertFileEquals ($ file , $ targetPath .DIRECTORY_SEPARATOR .'file ' );
1107
+ $ this ->assertFileEquals ($ file , $ realTargetPath .DIRECTORY_SEPARATOR .'file ' );
1108
+ }
1109
+
1068
1110
/**
1069
1111
* @dataProvider providePathsForIsAbsolutePath
1070
1112
*/
0 commit comments