Skip to content

Commit 0e5ad52

Browse files
committed
test: add test for get_filenames()
1 parent a168e0c commit 0e5ad52

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/system/Helpers/FilesystemHelperTest.php

+25
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,31 @@ public function testGetFilenamesFailure(): void
396396
$this->assertSame([], get_filenames(SUPPORTPATH . 'Files/shaker/'));
397397
}
398398

399+
public function testGetFilenamesWithSymlinks(): void
400+
{
401+
$targetDir = APPPATH . 'Language';
402+
$linkDir = APPPATH . 'Controllers/Language';
403+
file_exists($linkDir) && unlink($linkDir);
404+
symlink($targetDir, $linkDir);
405+
406+
$targetFile = APPPATH . 'Common.php';
407+
$linkFile = APPPATH . 'Controllers/Common.php';
408+
file_exists($linkFile) && unlink($linkFile);
409+
symlink($targetFile, $linkFile);
410+
411+
$this->assertSame([
412+
0 => 'BaseController.php',
413+
1 => 'Common.php',
414+
2 => 'Home.php',
415+
3 => 'Language',
416+
4 => 'Validation.php',
417+
5 => 'en',
418+
], get_filenames(APPPATH . 'Controllers'));
419+
420+
unlink($linkDir);
421+
unlink($linkFile);
422+
}
423+
399424
public function testGetDirFileInfo(): void
400425
{
401426
$file = SUPPORTPATH . 'Files/baker/banana.php';

0 commit comments

Comments
 (0)