@@ -238,4 +238,71 @@ public function testTouchCreatesEmptyFilesFromTraversableObject()
238238 $ this assertFileExists ($ basePath'2 ' );
239239 $ this assertFileExists ($ basePath'3 ' );
240240 }
241+ 
242+  public  function  testRemoveCleansFilesLinksAndDirectoriesIteratively ()
243+  {
244+  $ basePath$ this workspace .DIRECTORY_SEPARATOR .'directory ' .DIRECTORY_SEPARATOR ;
245+ 
246+  mkdir ($ basePath
247+  mkdir ($ basePath'dir ' );
248+  touch ($ basePath'file ' );
249+  link ($ basePath'file ' , $ basePath'link ' );
250+ 
251+  $ this filesystem ->remove ($ basePath
252+ 
253+  $ this assertTrue (!is_dir ($ basePath
254+  }
255+ 
256+  public  function  testRemoveCleansArrayOfFilesLinksAndDirectories ()
257+  {
258+  $ basePath$ this workspace .DIRECTORY_SEPARATOR ;
259+ 
260+  mkdir ($ basePath'dir ' );
261+  touch ($ basePath'file ' );
262+  link ($ basePath'file ' , $ basePath'link ' );
263+ 
264+  $ filesarray (
265+  $ basePath'dir ' , $ basePath'file ' , $ basePath'link ' 
266+  );
267+ 
268+  $ this filesystem ->remove ($ files
269+ 
270+  $ this assertTrue (!is_dir ($ basePath'dir ' ));
271+  $ this assertTrue (!is_file ($ basePath'file ' ));
272+  $ this assertTrue (!is_link ($ basePath'link ' ));
273+  }
274+ 
275+  public  function  testRemoveCleansTraversableObjectOfFilesLinksAndDirectories ()
276+  {
277+  $ basePath$ this workspace .DIRECTORY_SEPARATOR ;
278+ 
279+  mkdir ($ basePath'dir ' );
280+  touch ($ basePath'file ' );
281+  link ($ basePath'file ' , $ basePath'link ' );
282+ 
283+  $ filesnew  \ArrayObject (array (
284+  $ basePath'dir ' , $ basePath'file ' , $ basePath'link ' 
285+  ));
286+ 
287+  $ this filesystem ->remove ($ files
288+ 
289+  $ this assertTrue (!is_dir ($ basePath'dir ' ));
290+  $ this assertTrue (!is_file ($ basePath'file ' ));
291+  $ this assertTrue (!is_link ($ basePath'link ' ));
292+  }
293+ 
294+  public  function  testRemoveIgnoresNonExistingFiles ()
295+  {
296+  $ basePath$ this workspace .DIRECTORY_SEPARATOR ;
297+ 
298+  mkdir ($ basePath'dir ' );
299+ 
300+  $ filesarray (
301+  $ basePath'dir ' , $ basePath'file ' 
302+  );
303+ 
304+  $ this filesystem ->remove ($ files
305+ 
306+  $ this assertTrue (!is_dir ($ basePath'dir ' ));
307+  }
241308}
0 commit comments