@@ -949,16 +949,6 @@ public static function providePropertyNamesAndSearchPatternAndMatchingPropertyNa
949949 'color ' ,
950950 ['color ' ],
951951 ],
952- 'no match in empty list ' => [
953- [],
954- 'color ' ,
955- [],
956- ],
957- 'no match for property not in list ' => [
958- ['color ' , 'display ' ],
959- 'width ' ,
960- [],
961- ],
962952 'shorthand rule matched ' => [
963953 ['font ' ],
964954 'font- ' ,
@@ -1021,9 +1011,6 @@ static function (Rule $rule) use ($matchingPropertyNames): bool {
10211011
10221012 $ result = $ this ->subject ->getRules ($ searchPattern );
10231013
1024- if ($ matchingRules === []) {
1025- self ::assertSame ([], $ result );
1026- }
10271014 foreach ($ matchingRules as $ expectedMatchingRule ) {
10281015 self ::assertContains ($ expectedMatchingRule , $ result );
10291016 }
@@ -1046,15 +1033,51 @@ public function getRulesWithPatternFiltersNonMatchingRules(
10461033
10471034 $ result = $ this ->subject ->getRules ($ searchPattern );
10481035
1049- if ($ result === []) {
1050- self ::expectNotToPerformAssertions ();
1051- }
10521036 foreach ($ result as $ resultRule ) {
10531037 // 'expected' and 'actual' are transposed here due to necessity
10541038 self ::assertContains ($ resultRule ->getRule (), $ matchingPropertyNames );
10551039 }
10561040 }
10571041
1042+ /**
1043+ * @return array<string, array{0: list<string>, 1: string}>
1044+ */
1045+ public static function providePropertyNamesAndNonMatchingSearchPattern (): array
1046+ {
1047+ return [
1048+ 'no match in empty list ' => [
1049+ [],
1050+ 'color ' ,
1051+ ],
1052+ 'no match for different property ' => [
1053+ ['color ' ],
1054+ 'display ' ,
1055+ ],
1056+ 'no match for property not in list ' => [
1057+ ['color ' , 'display ' ],
1058+ 'width ' ,
1059+ ],
1060+ ];
1061+ }
1062+
1063+ /**
1064+ * @test
1065+ *
1066+ * @param list<string> $propertyNamesToSet
1067+ *
1068+ * @dataProvider providePropertyNamesAndNonMatchingSearchPattern
1069+ */
1070+ public function getRulesWithNonMatchingPatternReturnsEmptyArray (
1071+ array $ propertyNamesToSet ,
1072+ string $ searchPattern
1073+ ): void {
1074+ $ this ->setRulesFromPropertyNames ($ propertyNamesToSet );
1075+
1076+ $ result = $ this ->subject ->getRules ($ searchPattern );
1077+
1078+ self ::assertSame ([], $ result );
1079+ }
1080+
10581081 /**
10591082 * @test
10601083 */
0 commit comments