Skip to content

Commit 1dce859

Browse files
Merge branch '6.4' into 7.3
* 6.4: [FrameworkBundle] Normalize workflow places separately [Console] Don’t automatically append EOT to multiline test inputs [Validator] Review Albanian translations [Intl] Remove incorrect condition in CurrencyDataGenerator::icuPairToDate [Config] Fix `GlobResource` pattern with trailing slash
2 parents 62f0b07 + 3247e1b commit 1dce859

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

Resource/GlobResource.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function getIterator(): \Traversable
110110
if (class_exists(Finder::class)) {
111111
$regex = Glob::toRegex($pattern);
112112
if ($this->recursive) {
113-
$regex = substr_replace($regex, '(/|$)', -2, 1);
113+
$regex = substr_replace($regex, str_ends_with($pattern, '/') ? '' : '(/|$)', -2, 1);
114114
}
115115
} else {
116116
$regex = null;

Tests/Resource/GlobResourceTest.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,22 @@ protected function tearDown(): void
2525
touch($dir.'/Resource/.hiddenFile');
2626
}
2727

28-
public function testIterator()
28+
/**
29+
* @testWith ["/Resource"]
30+
* ["/**\/Resource"]
31+
* ["/**\/Resource/"]
32+
*/
33+
public function testIterator(string $pattern)
2934
{
3035
$dir = \dirname(__DIR__).\DIRECTORY_SEPARATOR.'Fixtures';
31-
$resource = new GlobResource($dir, '/Resource', true);
36+
$resource = new GlobResource($dir, $pattern, true);
3237

3338
$paths = iterator_to_array($resource);
3439

3540
$file = $dir.'/Resource'.\DIRECTORY_SEPARATOR.'ConditionalClass.php';
3641
$this->assertEquals([$file => new \SplFileInfo($file)], $paths);
3742
$this->assertInstanceOf(\SplFileInfo::class, current($paths));
3843
$this->assertSame($dir, $resource->getPrefix());
39-
40-
$resource = new GlobResource($dir, '/**/Resource', true);
41-
42-
$paths = iterator_to_array($resource);
43-
44-
$this->assertEquals([$file => $file], $paths);
45-
$this->assertInstanceOf(\SplFileInfo::class, current($paths));
46-
$this->assertSame($dir, $resource->getPrefix());
4744
}
4845

4946
public function testIteratorForExclusionDoesntIterateThroughSubfolders()

0 commit comments

Comments
 (0)