diff --git a/tests/Unit/RuleSet/RuleSetTest.php b/tests/Unit/RuleSet/RuleSetTest.php index a4d284e0..53123466 100644 --- a/tests/Unit/RuleSet/RuleSetTest.php +++ b/tests/Unit/RuleSet/RuleSetTest.php @@ -949,16 +949,6 @@ public static function providePropertyNamesAndSearchPatternAndMatchingPropertyNa 'color', ['color'], ], - 'no match in empty list' => [ - [], - 'color', - [], - ], - 'no match for property not in list' => [ - ['color', 'display'], - 'width', - [], - ], 'shorthand rule matched' => [ ['font'], 'font-', @@ -1021,9 +1011,6 @@ static function (Rule $rule) use ($matchingPropertyNames): bool { $result = $this->subject->getRules($searchPattern); - if ($matchingRules === []) { - self::assertSame([], $result); - } foreach ($matchingRules as $expectedMatchingRule) { self::assertContains($expectedMatchingRule, $result); } @@ -1046,15 +1033,51 @@ public function getRulesWithPatternFiltersNonMatchingRules( $result = $this->subject->getRules($searchPattern); - if ($result === []) { - self::expectNotToPerformAssertions(); - } foreach ($result as $resultRule) { // 'expected' and 'actual' are transposed here due to necessity self::assertContains($resultRule->getRule(), $matchingPropertyNames); } } + /** + * @return array, 1: string}> + */ + public static function providePropertyNamesAndNonMatchingSearchPattern(): array + { + return [ + 'no match in empty list' => [ + [], + 'color', + ], + 'no match for different property' => [ + ['color'], + 'display', + ], + 'no match for property not in list' => [ + ['color', 'display'], + 'width', + ], + ]; + } + + /** + * @test + * + * @param list $propertyNamesToSet + * + * @dataProvider providePropertyNamesAndNonMatchingSearchPattern + */ + public function getRulesWithNonMatchingPatternReturnsEmptyArray( + array $propertyNamesToSet, + string $searchPattern + ): void { + $this->setRulesFromPropertyNames($propertyNamesToSet); + + $result = $this->subject->getRules($searchPattern); + + self::assertSame([], $result); + } + /** * @test */