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 bf70e9e
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/system/Helpers/FilesystemHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,35 @@ public function testGetFilenamesFailure(): void
$this->assertSame([], get_filenames(SUPPORTPATH . 'Files/shaker/'));
}

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

$targetFile = APPPATH . 'Common.php';
$linkFile = APPPATH . 'Controllers/Common.php';
if (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 bf70e9e

Please sign in to comment.