File tree Expand file tree Collapse file tree 3 files changed +18
-2
lines changed
Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ public function handleException(Exception $exception): int
8484 */
8585 public static function fileLink (string $ filepath , string $ label = null ): string
8686 {
87- $ link = 'file:// ' .str_replace ('\\' , '/ ' , realpath ($ filepath ) ?: Hyde::path (Hyde:: pathToRelative ( $ filepath) ));
87+ $ link = 'file:// ' .str_replace ('\\' , '/ ' , realpath ($ filepath ) ?: Hyde::path ($ filepath ));
8888
8989 return $ label ? "<href= $ link> $ label</> " : $ link ;
9090 }
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ public function path(string $path = ''): string
6161 return $ this ->getBasePath ();
6262 }
6363
64- $ path = unslash ($ path );
64+ $ path = unslash ($ this -> pathToRelative ( $ path) );
6565
6666 return path_join ($ this ->getBasePath (), $ path );
6767 }
Original file line number Diff line number Diff line change @@ -91,6 +91,22 @@ public function test_path_method_returns_expected_value_regardless_of_trailing_d
9191 $ this ->assertEquals ('/foo/bar/file.php ' , $ this ->filesystem ->path ('\\/bar/file.php/ ' ));
9292 }
9393
94+ public function test_path_method_resolves_already_absolute_paths ()
95+ {
96+ Hyde::getInstance ()->setBasePath ('/foo ' );
97+ $ this ->assertEquals ('/foo/bar ' , $ this ->filesystem ->path ('/foo/bar ' ));
98+ }
99+
100+ public function test_path_method_resolves_already_absolute_paths_using_helper ()
101+ {
102+ $ this ->assertEquals ($ this ->filesystem ->path ('foo ' ), $ this ->filesystem ->path ($ this ->filesystem ->path ('foo ' )));
103+ }
104+
105+ public function test_path_method_resolves_already_absolute_paths_using_helper_with_trailing_slash ()
106+ {
107+ $ this ->assertEquals ($ this ->filesystem ->path ('foo ' ), $ this ->filesystem ->path ($ this ->filesystem ->path ('foo/ ' )));
108+ }
109+
94110 public function test_vendor_path_method_exists ()
95111 {
96112 $ this ->assertTrue (method_exists (Filesystem::class, 'vendorPath ' ));
You can’t perform that action at this time.
0 commit comments