88use Tempest \Support \Filesystem \Exceptions \NotFileException ;
99use Tempest \Support \Filesystem \Exceptions \NotFoundException ;
1010use Tempest \Support \Filesystem \Exceptions \NotReadableException ;
11+ use Tempest \Support \Filesystem \Exceptions \NotSymbolicLinkException ;
1112use Tempest \Support \Filesystem \Exceptions \RuntimeException ;
1213
1314final class FunctionsTest extends TestCase
@@ -197,6 +198,17 @@ public function test_get_permissions(): void
197198 $ this ->assertEquals (0o644 , $ permissions & 0o777 );
198199 }
199200
201+ public function test_get_permissions_not_found (): void
202+ {
203+ if (PHP_OS_FAMILY === 'Windows ' ) {
204+ $ this ->markTestSkipped ('Irrelevant on Windows. ' );
205+ }
206+
207+ $ this ->expectException (NotFoundException::class);
208+
209+ Filesystem \get_permissions ($ this ->fixtures . '/file.txt ' );
210+ }
211+
200212 public function test_ensure_directory_empty (): void
201213 {
202214 $ dir = $ this ->fixtures . '/tmp ' ;
@@ -310,6 +322,17 @@ public function test_list_directory(): void
310322 }
311323 }
312324
325+ public function test_list_directory_on_non_directory (): void
326+ {
327+ $ this ->expectException (NotDirectoryException::class);
328+
329+ $ file = $ this ->fixtures . '/file.txt ' ;
330+
331+ file_put_contents ($ file , '' );
332+
333+ Filesystem \list_directory ($ file );
334+ }
335+
313336 public function test_read_symbolic_link (): void
314337 {
315338 $ file = $ this ->fixtures . '/file.txt ' ;
@@ -323,6 +346,21 @@ public function test_read_symbolic_link(): void
323346 $ this ->assertEquals (realpath ($ file ), $ target );
324347 }
325348
349+ public function test_read_symbolic_link_on_non_symlink (): void
350+ {
351+ if (PHP_OS_FAMILY === 'Windows ' ) {
352+ $ this ->markTestSkipped ('Irrelevant on Windows. ' );
353+ }
354+
355+ $ this ->expectException (NotSymbolicLinkException::class);
356+
357+ $ file = $ this ->fixtures . '/file.txt ' ;
358+
359+ file_put_contents ($ file , '' );
360+
361+ Filesystem \read_symbolic_link ($ file );
362+ }
363+
326364 public function test_get_directory (): void
327365 {
328366 $ file = $ this ->fixtures . '/file.txt ' ;
@@ -410,6 +448,10 @@ public function test_write_file(): void
410448
411449 public function test_write_non_writable_file (): void
412450 {
451+ if (PHP_OS_FAMILY === 'Windows ' ) {
452+ $ this ->markTestSkipped ('Irrelevant on Windows. ' );
453+ }
454+
413455 $ this ->expectException (RuntimeException::class);
414456
415457 $ file = $ this ->fixtures . '/file.txt ' ;
0 commit comments