@@ -17,25 +17,22 @@ final class ChoiceTest extends TestCase {
1717 * Test callback.
1818 */
1919 #[DataProvider('dataProvider ' )]
20- public function test (mixed $ value , array $ choices , ?string $ message , ?\ UnexpectedValueException $ exception ): void {
20+ public function test (mixed $ value , array $ choices , ?string $ message , ?string $ expected ): void {
2121 $ validator = $ message ? new Choice ($ choices , $ message ) : new Choice ($ choices );
22- if ($ exception ) {
23- $ this ->expectExceptionObject ($ exception );
24- }
25- self ::assertSame ($ value , $ validator ($ value ));
22+ self ::assertSame ($ expected , $ validator ($ value ));
2623 }
2724
2825 public static function dataProvider (): array {
29- $ default_exception = new \ UnexpectedValueException ( 'The value you selected is not a valid choice. ' ) ;
26+ $ default_error = 'The value you selected is not a valid choice. ' ;
3027 return [
31- ['wrong ' , ['aaa ' , 'bbb ' ], NULL , $ default_exception ],
28+ ['wrong ' , ['aaa ' , 'bbb ' ], NULL , $ default_error ],
3229 ['aaa ' , ['aaa ' , 'bbb ' ], NULL , NULL ],
33- ['wrong ' , ['aaa ' , 'bbb ' ], 'Custom message. ' , new \ UnexpectedValueException ( 'Custom message. ' ) ],
34- [111 , ['111 ' , '222 ' ], NULL , $ default_exception ],
35- ['111 ' , [111 , 222 ], NULL , $ default_exception ],
30+ ['wrong ' , ['aaa ' , 'bbb ' ], 'Custom message. ' , 'Custom message. ' ],
31+ [111 , ['111 ' , '222 ' ], NULL , $ default_error ],
32+ ['111 ' , [111 , 222 ], NULL , $ default_error ],
3633 [111 , [111 , 222 ], NULL , NULL ],
37- [FALSE , ['aaa ' , 'bbb ' ], NULL , $ default_exception ],
38- [[], ['aaa ' , 'bbb ' ], NULL , $ default_exception ],
34+ [FALSE , ['aaa ' , 'bbb ' ], NULL , $ default_error ],
35+ [[], ['aaa ' , 'bbb ' ], NULL , $ default_error ],
3936 ];
4037 }
4138
0 commit comments