Skip to content

Commit 0d93403

Browse files
nufuedg
authored andcommitted
tests: added symlink Finder tests (#295)
1 parent 58572a8 commit 0d93403

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

tests/Utils/Finder.basic.phpt

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function export($iterator, bool $sort = true)
2828
}
2929

3030

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

@@ -172,3 +172,27 @@ test('absolute path in mask', function () { // will not work if there are charac
172172
FileSystem::unixSlashes(__DIR__),
173173
], export($finder));
174174
});
175+
176+
177+
test('symlink to file', function () {
178+
$finder = Finder::find('subdir/*.txt')->in('fixtures.finder3');
179+
Assert::same([
180+
'fixtures.finder3/subdir/file.txt',
181+
], export($finder));
182+
});
183+
184+
185+
test('symlink to directory', function () {
186+
$finder = Finder::findDirectories()->in('fixtures.finder3/another_subdir');
187+
Assert::same([
188+
'fixtures.finder3/another_subdir/subdir',
189+
], export($finder));
190+
});
191+
192+
193+
test('symlink to file in symlinked directory', function () {
194+
$finder = Finder::find('subdir/*.txt')->in('fixtures.finder3/another_subdir');
195+
Assert::same([
196+
'fixtures.finder3/another_subdir/subdir/file.txt',
197+
], export($finder));
198+
});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../subdir
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
File for testing purposes
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../file.txt

0 commit comments

Comments
 (0)