File tree 2 files changed +11
-0
lines changed
2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,10 @@ public function __construct(
62
62
throw new InvalidArgumentException ('The "mode" parameter value is not valid. ' );
63
63
}
64
64
65
+ if (null !== $ mode && !\in_array ($ mode , self ::$ validationModes , true )) {
66
+ throw new InvalidArgumentException ('The "mode" parameter value is not valid. ' );
67
+ }
68
+
65
69
parent ::__construct ($ options , $ groups , $ payload );
66
70
67
71
$ this ->message = $ message ?? $ this ->message ;
Original file line number Diff line number Diff line change @@ -33,6 +33,13 @@ public function testUnknownModesTriggerException()
33
33
new Email (['mode ' => 'Unknown Mode ' ]);
34
34
}
35
35
36
+ public function testUnknownModeArgumentsTriggerException ()
37
+ {
38
+ $ this ->expectException (InvalidArgumentException::class);
39
+ $ this ->expectExceptionMessage ('The "mode" parameter value is not valid. ' );
40
+ new Email (null , null , 'Unknown Mode ' );
41
+ }
42
+
36
43
public function testNormalizerCanBeSet ()
37
44
{
38
45
$ email = new Email (['normalizer ' => 'trim ' ]);
You can’t perform that action at this time.
0 commit comments