diff --git a/tests/Composer/Test/Repository/FilterRepositoryTest.php b/tests/Composer/Test/Repository/FilterRepositoryTest.php index 111d58431..726cc549c 100644 --- a/tests/Composer/Test/Repository/FilterRepositoryTest.php +++ b/tests/Composer/Test/Repository/FilterRepositoryTest.php @@ -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/*']]);