@@ -799,6 +799,80 @@ public function testSymlinkCreatesTargetDirectoryIfItDoesNotExist()
799
799
$ this ->assertEquals ($ file , readlink ($ link2 ));
800
800
}
801
801
802
+ public function testReadLink ()
803
+ {
804
+ $ this ->markAsSkippedIfSymlinkIsMissing ();
805
+
806
+ $ file = $ this ->workspace .DIRECTORY_SEPARATOR .'file ' ;
807
+ $ link1 = $ this ->workspace .DIRECTORY_SEPARATOR .'dir ' .DIRECTORY_SEPARATOR .'link ' ;
808
+ $ link2 = $ this ->workspace .DIRECTORY_SEPARATOR .'dir ' .DIRECTORY_SEPARATOR .'subdir ' .DIRECTORY_SEPARATOR .'link ' ;
809
+
810
+ touch ($ file );
811
+
812
+ $ this ->filesystem ->symlink ($ file , $ link1 );
813
+ $ this ->filesystem ->symlink ($ link1 , $ link2 );
814
+
815
+ $ this ->assertTrue (is_link ($ link1 ));
816
+ $ this ->assertEquals ($ file , $ this ->filesystem ->readlink ($ link1 ));
817
+ $ this ->assertTrue (is_link ($ link2 ));
818
+ $ this ->assertEquals ($ link1 , $ this ->filesystem ->readlink ($ link2 ));
819
+ }
820
+
821
+ /**
822
+ * @expectedException \Symfony\Component\Filesystem\Exception\IOException
823
+ */
824
+ public function testReadLinkNotLink ()
825
+ {
826
+ $ file = $ this ->workspace .DIRECTORY_SEPARATOR .'file ' ;
827
+ touch ($ file );
828
+ $ this ->filesystem ->readlink ($ file );
829
+ }
830
+
831
+ /**
832
+ * @expectedException \Symfony\Component\Filesystem\Exception\IOException
833
+ */
834
+ public function testReadLinkFails ()
835
+ {
836
+ $ this ->filesystem ->readlink ($ this ->workspace .DIRECTORY_SEPARATOR .'invalid ' );
837
+ }
838
+
839
+ public function testRealPath ()
840
+ {
841
+ $ this ->markAsSkippedIfSymlinkIsMissing ();
842
+
843
+ $ file = $ this ->workspace .DIRECTORY_SEPARATOR .'file ' ;
844
+ $ link1 = $ this ->workspace .DIRECTORY_SEPARATOR .'dir ' .DIRECTORY_SEPARATOR .'link ' ;
845
+ $ link2 = $ this ->workspace .DIRECTORY_SEPARATOR .'dir ' .DIRECTORY_SEPARATOR .'subdir ' .DIRECTORY_SEPARATOR .'link ' ;
846
+
847
+ touch ($ file );
848
+
849
+ $ this ->filesystem ->symlink ($ file , $ link1 );
850
+ $ this ->filesystem ->symlink ($ link1 , $ link2 );
851
+
852
+ $ this ->assertTrue (is_link ($ link1 ));
853
+ $ this ->assertEquals ($ file , $ this ->filesystem ->realpath ($ link1 ));
854
+ $ this ->assertTrue (is_link ($ link2 ));
855
+ $ this ->assertEquals ($ file , $ this ->filesystem ->realpath ($ link2 ));
856
+ }
857
+
858
+ /**
859
+ * @expectedException \Symfony\Component\Filesystem\Exception\IOException
860
+ */
861
+ public function testRealPathNotLink ()
862
+ {
863
+ $ file = $ this ->workspace .DIRECTORY_SEPARATOR .'file ' ;
864
+ touch ($ file );
865
+ $ this ->filesystem ->realpath ($ file );
866
+ }
867
+
868
+ /**
869
+ * @expectedException \Symfony\Component\Filesystem\Exception\IOException
870
+ */
871
+ public function testRealPathFails ()
872
+ {
873
+ $ this ->filesystem ->realpath ($ this ->workspace .DIRECTORY_SEPARATOR .'invalid ' );
874
+ }
875
+
802
876
/**
803
877
* @dataProvider providePathsForMakePathRelative
804
878
*/
0 commit comments