@@ -18,9 +18,12 @@ class ChoiceTest extends AbstractTest
1818
1919 public static function provideRuleUnexpectedValueData (): \Generator
2020 {
21- yield 'multiple but not array ' => [
22- new Choice ([1 , 2 ], true ), 1 , '/Expected value of type "array" when multiple, "(.*)" given/ '
23- ];
21+ $ constraints = [1 , 2 , 3 , 4 , 5 ];
22+ $ multipleMessage = '/Expected value of type "array" when multiple, "(.*)" given/ ' ;
23+ $ constraintMessage = '/Max constraint value must be greater than or equal to min constraint value./ ' ;
24+
25+ yield 'multiple not array ' => [new Choice ($ constraints , true ), 1 , $ multipleMessage ];
26+ yield 'min greater than max constraint ' => [new Choice ($ constraints , true , 3 , 2 ), [1 , 2 ], $ constraintMessage ];
2427 }
2528
2629 public static function provideRuleFailureConditionData (): \Generator
@@ -50,7 +53,8 @@ public static function provideRuleSuccessConditionData(): \Generator
5053 yield 'multiple valid choices ' => [new Choice ($ constraints , true ), [1 , 2 , 3 ]];
5154 yield 'min constraint ' => [new Choice ($ constraints , true , 2 ), [1 , 2 ]];
5255 yield 'max constraint ' => [new Choice ($ constraints , true , null , 2 ), [1 , 2 ]];
53- yield 'min and max constraint ' => [new Choice ($ constraints , true , 2 , 2 ), [1 , 2 ]];
56+ yield 'min and max constraint ' => [new Choice ($ constraints , true , 2 , 4 ), [1 , 2 , 3 ]];
57+ yield 'same min and max constraint ' => [new Choice ($ constraints , true , 2 , 2 ), [1 , 2 ]];
5458 }
5559
5660 public static function provideRuleMessageOptionData (): \Generator
0 commit comments