@@ -1348,46 +1348,6 @@ public function testMirrorContentsWithSameNameAsSourceOrTargetWithDeleteOption()
1348
1348
$ this ->assertFileNotExists ($ targetPath .'target ' );
1349
1349
}
1350
1350
1351
- public function testMirrorWithCustomIterator ()
1352
- {
1353
- $ sourcePath = $ this ->workspace .\DIRECTORY_SEPARATOR .'source ' .\DIRECTORY_SEPARATOR ;
1354
- mkdir ($ sourcePath );
1355
-
1356
- $ file = $ sourcePath .\DIRECTORY_SEPARATOR .'file ' ;
1357
- file_put_contents ($ file , 'FILE ' );
1358
-
1359
- $ targetPath = $ this ->workspace .\DIRECTORY_SEPARATOR .'target ' .\DIRECTORY_SEPARATOR ;
1360
-
1361
- $ splFile = new \SplFileInfo ($ file );
1362
- $ iterator = new \ArrayObject ([$ splFile ]);
1363
-
1364
- $ this ->filesystem ->mirror ($ sourcePath , $ targetPath , $ iterator );
1365
-
1366
- $ this ->assertTrue (is_dir ($ targetPath ));
1367
- $ this ->assertFileEquals ($ file , $ targetPath .\DIRECTORY_SEPARATOR .'file ' );
1368
- }
1369
-
1370
- /**
1371
- * @expectedException \Symfony\Component\Filesystem\Exception\IOException
1372
- * @expectedExceptionMessageRegExp /Unable to mirror "(.*)" directory/
1373
- */
1374
- public function testMirrorWithCustomIteratorWithRelativePath ()
1375
- {
1376
- $ sourcePath = $ this ->workspace .\DIRECTORY_SEPARATOR .'source ' .\DIRECTORY_SEPARATOR .'.. ' .\DIRECTORY_SEPARATOR .'source ' .\DIRECTORY_SEPARATOR ;
1377
- $ realSourcePath = $ this ->workspace .\DIRECTORY_SEPARATOR .'source ' .\DIRECTORY_SEPARATOR ;
1378
- mkdir ($ realSourcePath );
1379
-
1380
- $ file = $ realSourcePath .'file ' ;
1381
- file_put_contents ($ file , 'FILE ' );
1382
-
1383
- $ targetPath = $ this ->workspace .\DIRECTORY_SEPARATOR .'target ' .\DIRECTORY_SEPARATOR .'.. ' .\DIRECTORY_SEPARATOR .'target ' .\DIRECTORY_SEPARATOR ;
1384
-
1385
- $ splFile = new \SplFileInfo ($ file );
1386
- $ iterator = new \ArrayObject ([$ splFile ]);
1387
-
1388
- $ this ->filesystem ->mirror ($ sourcePath , $ targetPath , $ iterator );
1389
- }
1390
-
1391
1351
public function testMirrorAvoidCopyingTargetDirectoryIfInSourceDirectory ()
1392
1352
{
1393
1353
$ sourcePath = $ this ->workspace .\DIRECTORY_SEPARATOR .'source ' .\DIRECTORY_SEPARATOR ;
@@ -1402,15 +1362,20 @@ public function testMirrorAvoidCopyingTargetDirectoryIfInSourceDirectory()
1402
1362
1403
1363
$ targetPath = $ sourcePath .'target ' .\DIRECTORY_SEPARATOR ;
1404
1364
1405
- $ this ->filesystem ->mirror ($ sourcePath , $ targetPath );
1365
+ if ('\\' !== \DIRECTORY_SEPARATOR ) {
1366
+ $ this ->filesystem ->symlink ($ targetPath , $ sourcePath .'target_simlink ' );
1367
+ }
1406
1368
1407
- $ this ->assertTrue (is_dir ($ targetPath ));
1408
- $ this ->assertTrue (is_dir ($ targetPath .'directory ' ));
1369
+ $ this ->filesystem ->mirror ($ sourcePath , $ targetPath , null , ['delete ' => true ]);
1370
+
1371
+ $ this ->assertTrue ($ this ->filesystem ->exists ($ targetPath ));
1372
+ $ this ->assertTrue ($ this ->filesystem ->exists ($ targetPath .'directory ' ));
1409
1373
1410
1374
$ this ->assertFileEquals ($ file1 , $ targetPath .'directory ' .\DIRECTORY_SEPARATOR .'file1 ' );
1411
1375
$ this ->assertFileEquals ($ file2 , $ targetPath .'file2 ' );
1412
1376
1413
- $ this ->assertFileNotExists ($ targetPath .'target ' );
1377
+ $ this ->assertFalse ($ this ->filesystem ->exists ($ targetPath .'target_simlink ' ));
1378
+ $ this ->assertFalse ($ this ->filesystem ->exists ($ targetPath .'target ' ));
1414
1379
}
1415
1380
1416
1381
/**
0 commit comments