1
0
Fork 0

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
David Zülke 2023-05-28 15:02:12 +02:00 committed by GitHub
parent 52f6f74b7c
commit c45b403967
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 0 deletions

View File

@ -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/*']]);