Skip to content

Commit

Permalink
test: add test for get_filenames()
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Dec 6, 2023
1 parent a168e0c commit 0e5ad52
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/system/Helpers/FilesystemHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,31 @@ public function testGetFilenamesFailure(): void
$this->assertSame([], get_filenames(SUPPORTPATH . 'Files/shaker/'));
}

public function testGetFilenamesWithSymlinks(): void
{
$targetDir = APPPATH . 'Language';
$linkDir = APPPATH . 'Controllers/Language';
file_exists($linkDir) && unlink($linkDir);
symlink($targetDir, $linkDir);

$targetFile = APPPATH . 'Common.php';
$linkFile = APPPATH . 'Controllers/Common.php';
file_exists($linkFile) && unlink($linkFile);
symlink($targetFile, $linkFile);

$this->assertSame([
0 => 'BaseController.php',
1 => 'Common.php',
2 => 'Home.php',
3 => 'Language',
4 => 'Validation.php',
5 => 'en',
], get_filenames(APPPATH . 'Controllers'));

unlink($linkDir);
unlink($linkFile);
}

public function testGetDirFileInfo(): void
{
$file = SUPPORTPATH . 'Files/baker/banana.php';
Expand Down

0 comments on commit 0e5ad52

Please sign in to comment.