Skip to content

Commit 3e0bdfb

Browse files
committed
Fix issue with '.' based glob
1 parent 3970eff commit 3e0bdfb

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/Specification/Glob.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,12 @@ public function canBeSatisfiedBySomethingBelow(array $value) : bool
366366
$valuePathPrefix = implode('/', array_slice($valueSegments, 1, max($howManySegmentsToConsider-1, 0)));
367367
$prefixValue = $value;
368368
$prefixValue['path'] = $valuePathPrefix;
369-
$spec = new Glob($boundedPrefixGlob);
370369

370+
if ($boundedPrefixGlob === '') {
371+
$boundedPrefixGlob = '/';
372+
}
373+
374+
$spec = new Glob($boundedPrefixGlob);
371375
return $spec->isSatisfiedBy($prefixValue);
372376
}
373377

tests/unit/Specification/GlobTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,15 @@ public function testInvalidGlobThrows(string $pattern) : void
6161
new Glob($pattern);
6262
}
6363

64+
/**
65+
* @covers ::canBeSatisfiedBySomethingBelow
66+
*/
67+
public function testCanBeSatisfiedBySomethingBelow() : void
68+
{
69+
$glob = new Glob('/**/*');
70+
$this->assertTrue($glob->canBeSatisfiedBySomethingBelow(['path' => 'src']));
71+
}
72+
6473
public function invalidPatternProvider() : Generator
6574
{
6675
$invalidPatterns = [

0 commit comments

Comments
 (0)