Skip to content

Commit

Permalink
tests: added symlink Finder tests (#295)
Browse files Browse the repository at this point in the history
  • Loading branch information
nufue authored and dg committed Sep 19, 2023
1 parent 6ffe33b commit c67c9f3
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
26 changes: 25 additions & 1 deletion tests/Utils/Finder.basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function export($iterator, bool $sort = true)
}


test('expty search', function () {
test('empty search', function () {
$finder = (new Finder)->in('fixtures.finder');
Assert::same([], export($finder));

Expand Down Expand Up @@ -172,3 +172,27 @@ test('absolute path in mask', function () { // will not work if there are charac
FileSystem::unixSlashes(__DIR__),
], export($finder));
});


test('symlink to file', function () {
$finder = Finder::find('subdir/*.txt')->in('fixtures.finder3');
Assert::same([
'fixtures.finder3/subdir/file.txt',
], export($finder));
});


test('symlink to directory', function () {
$finder = Finder::findDirectories()->in('fixtures.finder3/another_subdir');
Assert::same([
'fixtures.finder3/another_subdir/subdir',
], export($finder));
});


test('symlink to file in symlinked directory', function () {
$finder = Finder::find('subdir/*.txt')->in('fixtures.finder3/another_subdir');
Assert::same([
'fixtures.finder3/another_subdir/subdir/file.txt',
], export($finder));
});
1 change: 1 addition & 0 deletions tests/Utils/fixtures.finder3/another_subdir/subdir
1 change: 1 addition & 0 deletions tests/Utils/fixtures.finder3/file.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
File for testing purposes
1 change: 1 addition & 0 deletions tests/Utils/fixtures.finder3/subdir/file.txt

0 comments on commit c67c9f3

Please sign in to comment.