File tree 1 file changed +19
-11
lines changed
1 file changed +19
-11
lines changed Original file line number Diff line number Diff line change @@ -183,18 +183,26 @@ public function testSubmitNonFormFieldError(): void
183
183
$ m = $ m ->createEntity ();
184
184
$ this ->form ->setModel ($ m , ['foo ' ]);
185
185
186
+ $ submitReached = false ;
187
+ $ catchReached = false ;
186
188
try {
187
- $ this ->assertSubmit (['foo ' => 'x ' ], function (Model $ model ) {
188
- $ model ->set ('bar ' , null );
189
- });
190
-
191
- static ::assertFalse (true );
192
- } catch (UnhandledCallbackExceptionError $ e ) {
193
- $ this ->expectException (ValidationException::class);
194
- $ this ->expectExceptionMessage ('Must not be null ' );
195
- static ::assertSame ('bar ' , $ e ->getPrevious ()->getParams ()['field ' ]->shortName );
196
-
197
- throw $ e ->getPrevious ();
189
+ try {
190
+ $ this ->assertSubmit (['foo ' => 'x ' ], function (Model $ model ) use (&$ submitReached ) {
191
+ $ submitReached = true ;
192
+ $ model ->set ('bar ' , null );
193
+ });
194
+ } catch (UnhandledCallbackExceptionError $ e ) {
195
+ $ catchReached = true ;
196
+ static ::assertSame ('bar ' , $ e ->getPrevious ()->getParams ()['field ' ]->shortName ); // @phpstan-ignore-line
197
+
198
+ $ this ->expectException (ValidationException::class);
199
+ $ this ->expectExceptionMessage ('Must not be null ' );
200
+
201
+ throw $ e ->getPrevious ();
202
+ }
203
+ } finally {
204
+ static ::assertTrue ($ submitReached );
205
+ static ::assertTrue ($ catchReached );
198
206
}
199
207
}
200
208
}
You can’t perform that action at this time.
0 commit comments