Skip to content

Commit 32ed27b

Browse files
authored
feature #59 Follow symlinks in themes/ (jacquesbh)
This PR was merged into the 2.0-dev branch. Discussion ---------- If a theme is a symlink then it'll now be catched by the Finder. Commits ------- a1446a9 Follow symlinks in themes/
2 parents c07ee21 + a1446a9 commit 32ed27b

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

spec/Locator/RecursiveFileLocatorSpec.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ function it_searches_for_file(FinderFactoryInterface $finderFactory, Finder $fin
3939
$finder->in('/search/path/')->shouldBeCalled()->willReturn($finder);
4040
$finder->ignoreUnreadableDirs()->shouldBeCalled()->willReturn($finder);
4141
$finder->files()->shouldBeCalled()->willReturn($finder);
42+
$finder->followLinks()->shouldBeCalled()->willReturn($finder);
4243

4344
$finder->getIterator()->willReturn(new \ArrayIterator([
4445
$splFileInfo->getWrappedObject(),
@@ -61,6 +62,7 @@ function it_searches_for_files(
6162
$finder->in('/search/path/')->shouldBeCalled()->willReturn($finder);
6263
$finder->ignoreUnreadableDirs()->shouldBeCalled()->willReturn($finder);
6364
$finder->files()->shouldBeCalled()->willReturn($finder);
65+
$finder->followLinks()->shouldBeCalled()->willReturn($finder);
6466

6567
$finder->getIterator()->willReturn(new \ArrayIterator([
6668
$firstSplFileInfo->getWrappedObject(),
@@ -90,6 +92,7 @@ function it_searches_for_files_at_a_maximum_depth(
9092
$finder->in('/search/path/')->shouldBeCalled()->willReturn($finder);
9193
$finder->ignoreUnreadableDirs()->shouldBeCalled()->willReturn($finder);
9294
$finder->files()->shouldBeCalled()->willReturn($finder);
95+
$finder->followLinks()->shouldBeCalled()->willReturn($finder);
9396

9497
$finder->getIterator()->willReturn(new \ArrayIterator([
9598
$secondSplFileInfo->getWrappedObject(),
@@ -123,6 +126,7 @@ function it_throws_an_exception_if_there_is_no_file_that_matches_the_given_name(
123126
$finder->in('/search/path/')->shouldBeCalled()->willReturn($finder);
124127
$finder->ignoreUnreadableDirs()->shouldBeCalled()->willReturn($finder);
125128
$finder->files()->shouldBeCalled()->willReturn($finder);
129+
$finder->followLinks()->shouldBeCalled()->willReturn($finder);
126130

127131
$finder->getIterator()->willReturn(new \ArrayIterator());
128132

@@ -139,6 +143,7 @@ function it_throws_an_exception_if_there_is_there_are_not_any_files_that_matches
139143
$finder->in('/search/path/')->shouldBeCalled()->willReturn($finder);
140144
$finder->ignoreUnreadableDirs()->shouldBeCalled()->willReturn($finder);
141145
$finder->files()->shouldBeCalled()->willReturn($finder);
146+
$finder->followLinks()->shouldBeCalled()->willReturn($finder);
142147

143148
$finder->getIterator()->willReturn(new \ArrayIterator());
144149

@@ -159,11 +164,13 @@ function it_isolates_finding_paths_from_multiple_sources(
159164
$firstFinder->in('/search/path/first/')->shouldBeCalled()->willReturn($firstFinder);
160165
$firstFinder->ignoreUnreadableDirs()->shouldBeCalled()->willReturn($firstFinder);
161166
$firstFinder->files()->shouldBeCalled()->willReturn($firstFinder);
167+
$firstFinder->followLinks()->shouldBeCalled()->willReturn($firstFinder);
162168

163169
$secondFinder->name('readme.md')->shouldBeCalled()->willReturn($secondFinder);
164170
$secondFinder->in('/search/path/second/')->shouldBeCalled()->willReturn($secondFinder);
165171
$secondFinder->ignoreUnreadableDirs()->shouldBeCalled()->willReturn($secondFinder);
166172
$secondFinder->files()->shouldBeCalled()->willReturn($secondFinder);
173+
$secondFinder->followLinks()->shouldBeCalled()->willReturn($secondFinder);
167174

168175
$firstFinder->getIterator()->willReturn(new \ArrayIterator([$splFileInfo->getWrappedObject()]));
169176
$secondFinder->getIterator()->willReturn(new \ArrayIterator());
@@ -189,11 +196,13 @@ function it_silences_finder_exceptions_even_if_searching_in_multiple_sources(
189196
$firstFinder->in('/search/path/first/')->shouldBeCalled()->willReturn($firstFinder);
190197
$firstFinder->ignoreUnreadableDirs()->shouldBeCalled()->willReturn($firstFinder);
191198
$firstFinder->files()->shouldBeCalled()->willReturn($firstFinder);
199+
$firstFinder->followLinks()->shouldBeCalled()->willReturn($firstFinder);
192200

193201
$secondFinder->name('readme.md')->shouldBeCalled()->willReturn($secondFinder);
194202
$secondFinder->in('/search/path/second/')->shouldBeCalled()->willReturn($secondFinder);
195203
$secondFinder->ignoreUnreadableDirs()->shouldBeCalled()->willReturn($secondFinder);
196204
$secondFinder->files()->shouldBeCalled()->willReturn($secondFinder);
205+
$secondFinder->followLinks()->shouldBeCalled()->willReturn($secondFinder);
197206

198207
$firstFinder->getIterator()->willReturn(new \ArrayIterator([$splFileInfo->getWrappedObject()]));
199208
$secondFinder->getIterator()->willThrow(\InvalidArgumentException::class);

src/Locator/RecursiveFileLocator.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ private function doLocateFilesNamed(string $name): \Generator
6363

6464
$finder
6565
->files()
66+
->followLinks()
6667
->name($name)
6768
->ignoreUnreadableDirs()
6869
->in($path);

0 commit comments

Comments
 (0)