@@ -313,6 +313,56 @@ public function testRemoveCleansInvalidLinks()
313313 $ this ->assertTrue (!is_dir ($ basePath ));
314314 }
315315
316+ public function testFilesExists ()
317+ {
318+ $ basePath = $ this ->workspace .DIRECTORY_SEPARATOR .'directory ' .DIRECTORY_SEPARATOR ;
319+
320+ mkdir ($ basePath );
321+ touch ($ basePath .'file1 ' );
322+ mkdir ($ basePath .'folder ' );
323+
324+ $ this ->assertTrue ($ this ->filesystem ->exists ($ basePath .'file1 ' ));
325+ $ this ->assertTrue ($ this ->filesystem ->exists ($ basePath .'folder ' ));
326+ }
327+
328+ public function testFilesExistsTraversableObjectOfFilesAndDirectories ()
329+ {
330+ $ basePath = $ this ->workspace .DIRECTORY_SEPARATOR ;
331+
332+ mkdir ($ basePath .'dir ' );
333+ touch ($ basePath .'file ' );
334+
335+ $ files = new \ArrayObject (array (
336+ $ basePath .'dir ' , $ basePath .'file '
337+ ));
338+
339+ $ this ->assertTrue ($ this ->filesystem ->exists ($ files ));
340+ }
341+
342+ public function testFilesNotExistsTraversableObjectOfFilesAndDirectories ()
343+ {
344+ $ basePath = $ this ->workspace .DIRECTORY_SEPARATOR ;
345+
346+ mkdir ($ basePath .'dir ' );
347+ touch ($ basePath .'file ' );
348+ touch ($ basePath .'file2 ' );
349+
350+ $ files = new \ArrayObject (array (
351+ $ basePath .'dir ' , $ basePath .'file ' , $ basePath .'file2 '
352+ ));
353+
354+ unlink ($ basePath .'file ' );
355+
356+ $ this ->assertFalse ($ this ->filesystem ->exists ($ files ));
357+ }
358+
359+ public function testInvalidFileNotExists ()
360+ {
361+ $ basePath = $ this ->workspace .DIRECTORY_SEPARATOR .'directory ' .DIRECTORY_SEPARATOR ;
362+
363+ $ this ->assertFalse ($ this ->filesystem ->exists ($ basePath .time ()));
364+ }
365+
316366 public function testChmodChangesFileMode ()
317367 {
318368 $ this ->markAsSkippedIfChmodIsMissing ();
@@ -421,18 +471,18 @@ public function testSymlink()
421471 $ this ->assertTrue (is_link ($ link ));
422472 $ this ->assertEquals ($ file , readlink ($ link ));
423473 }
424-
474+
425475 /**
426- * @depends testSymlink
476+ * @depends testSymlink
427477 */
428478 public function testRemoveSymlink ()
429479 {
430480 $ this ->markAsSkippedIfSymlinkIsMissing ();
431-
481+
432482 $ link = $ this ->workspace .DIRECTORY_SEPARATOR .'link ' ;
433-
483+
434484 $ this ->filesystem ->remove ($ link );
435-
485+
436486 $ this ->assertTrue (!is_link ($ link ));
437487 }
438488
0 commit comments