@@ -17,22 +17,19 @@ final class RegExpTest extends TestCase {
1717 * Test callback.
1818 */
1919 #[DataProvider('dataProvider ' )]
20- public function test (mixed $ machine_name , string $ pattern , ?string $ message , ? \ UnexpectedValueException $ exception ): void {
20+ public function test (mixed $ machine_name , string $ pattern , ?string $ message , $ expected ): void {
2121 $ validator = new RegExp ($ pattern , $ message );
22- if ($ exception ) {
23- $ this ->expectExceptionObject ($ exception );
24- }
25- self ::assertSame ($ machine_name , $ validator ($ machine_name ));
22+ self ::assertSame ($ expected , $ validator ($ machine_name ));
2623 }
2724
2825 public static function dataProvider (): array {
2926 return [
30- ['wrong ' , '/abc/ ' , NULL , new \ UnexpectedValueException ( 'The value does not match pattern "/abc/". ' ) ],
31- ['wrong ' , '/abc/ ' , 'Custom message ' , new \ UnexpectedValueException ( 'Custom message ' ) ],
27+ ['wrong ' , '/abc/ ' , NULL , 'The value does not match pattern "/abc/". ' ],
28+ ['wrong ' , '/abc/ ' , 'Custom message ' , 'Custom message ' ],
3229 ['abc ' , '/abc/ ' , NULL , NULL ],
33- [NULL , '/abc/ ' , NULL , new \ UnexpectedValueException ( 'The value does not match pattern "/abc/". ' ) ],
34- [FALSE , '/abc/ ' , NULL , new \ UnexpectedValueException ( 'The value does not match pattern "/abc/". ' ) ],
35- [[], '/abc/ ' , NULL , new \ UnexpectedValueException ( 'The value does not match pattern "/abc/". ' ) ],
30+ [NULL , '/abc/ ' , NULL , 'The value does not match pattern "/abc/". ' ],
31+ [FALSE , '/abc/ ' , NULL , 'The value does not match pattern "/abc/". ' ],
32+ [[], '/abc/ ' , NULL , 'The value does not match pattern "/abc/". ' ],
3633 ];
3734 }
3835
0 commit comments