tests for empty or absent repository filters (#11476)
The behavior in FilterRepository is currently correct, but not explicitly tested. Also add a test that ensures both filters can't be there simultaneously.pull/11485/head
parent
52f6f74b7c
commit
c45b403967
|
@ -59,9 +59,22 @@ class FilterRepositoryTest extends TestCase
|
|||
// make sure sub-patterns are not matched without wildcard
|
||||
[['foo/aaa', 'foo/bbb', 'bar/xxx', 'baz/yyy'], ['exclude' => ['foo/aa', 'az/yyy']]],
|
||||
[[], ['only' => ['foo/aa', 'az/yyy']]],
|
||||
// empty "only" means no packages allowed
|
||||
[[], ['only' => []]],
|
||||
// absent "only" means all packages allowed
|
||||
[['foo/aaa', 'foo/bbb', 'bar/xxx', 'baz/yyy'], []],
|
||||
// empty or absent "exclude" have the same effect: none
|
||||
[['foo/aaa', 'foo/bbb', 'bar/xxx', 'baz/yyy'], ['exclude' => []]],
|
||||
[['foo/aaa', 'foo/bbb', 'bar/xxx', 'baz/yyy'], []],
|
||||
];
|
||||
}
|
||||
|
||||
public function testBothFiltersDisallowed(): void
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
new FilterRepository($this->arrayRepo, ['only' => [], 'exclude' => []]);
|
||||
}
|
||||
|
||||
public function testSecurityAdvisoriesDisabledInChild(): void
|
||||
{
|
||||
$repo = new FilterRepository($this->arrayRepo, ['only' => ['foo/*']]);
|
||||
|
|
Loading…
Reference in New Issue