@@ -767,6 +767,78 @@ public function testSymlinkCreatesTargetDirectoryIfItDoesNotExist()
767
767
$ this ->assertEquals ($ file , readlink ($ link2 ));
768
768
}
769
769
770
+ public function testReadLink ()
771
+ {
772
+ $ this ->markAsSkippedIfSymlinkIsMissing ();
773
+
774
+ $ file = $ this ->workspace .DIRECTORY_SEPARATOR .'file ' ;
775
+ $ link1 = $ this ->workspace .DIRECTORY_SEPARATOR .'dir ' .DIRECTORY_SEPARATOR .'link ' ;
776
+ $ link2 = $ this ->workspace .DIRECTORY_SEPARATOR .'dir ' .DIRECTORY_SEPARATOR .'subdir ' .DIRECTORY_SEPARATOR .'link ' ;
777
+
778
+ touch ($ file );
779
+
780
+ $ this ->filesystem ->symlink ($ file , $ link1 );
781
+ $ this ->filesystem ->symlink ($ link1 , $ link2 );
782
+
783
+ $ this ->assertTrue (is_link ($ link1 ));
784
+ $ this ->assertEquals ($ file , $ this ->filesystem ->readlink ($ link1 ));
785
+ $ this ->assertTrue (is_link ($ link2 ));
786
+ $ this ->assertEquals ($ link1 , $ this ->filesystem ->readlink ($ link2 ));
787
+ }
788
+
789
+ public function testReadLinkNotLink ()
790
+ {
791
+ $ file = $ this ->workspace .DIRECTORY_SEPARATOR .'file ' ;
792
+
793
+ touch ($ file );
794
+
795
+ $ this ->assertEquals ($ file , $ this ->filesystem ->readlink ($ file ));
796
+ }
797
+
798
+ /**
799
+ * @expectedException \Symfony\Component\Filesystem\Exception\IOException
800
+ */
801
+ public function testReadLinkFails ()
802
+ {
803
+ $ this ->filesystem ->readlink ($ this ->workspace .DIRECTORY_SEPARATOR .'invalid ' );
804
+ }
805
+
806
+ public function testRealPath ()
807
+ {
808
+ $ this ->markAsSkippedIfSymlinkIsMissing ();
809
+
810
+ $ file = $ this ->workspace .DIRECTORY_SEPARATOR .'file ' ;
811
+ $ link1 = $ this ->workspace .DIRECTORY_SEPARATOR .'dir ' .DIRECTORY_SEPARATOR .'link ' ;
812
+ $ link2 = $ this ->workspace .DIRECTORY_SEPARATOR .'dir ' .DIRECTORY_SEPARATOR .'subdir ' .DIRECTORY_SEPARATOR .'link ' ;
813
+
814
+ touch ($ file );
815
+
816
+ $ this ->filesystem ->symlink ($ file , $ link1 );
817
+ $ this ->filesystem ->symlink ($ link1 , $ link2 );
818
+
819
+ $ this ->assertTrue (is_link ($ link1 ));
820
+ $ this ->assertEquals ($ file , $ this ->filesystem ->realpath ($ link1 ));
821
+ $ this ->assertTrue (is_link ($ link2 ));
822
+ $ this ->assertEquals ($ file , $ this ->filesystem ->realpath ($ link2 ));
823
+ }
824
+
825
+ public function testRealPathNotLink ()
826
+ {
827
+ $ file = $ this ->workspace .DIRECTORY_SEPARATOR .'file ' ;
828
+
829
+ touch ($ file );
830
+
831
+ $ this ->assertEquals ($ file , $ this ->filesystem ->realpath ($ file ));
832
+ }
833
+
834
+ /**
835
+ * @expectedException \Symfony\Component\Filesystem\Exception\IOException
836
+ */
837
+ public function testRealPathFails ()
838
+ {
839
+ $ this ->filesystem ->realpath ($ this ->workspace .DIRECTORY_SEPARATOR .'invalid ' );
840
+ }
841
+
770
842
/**
771
843
* @dataProvider providePathsForMakePathRelative
772
844
*/
0 commit comments