@@ -989,11 +989,16 @@ public function assertOnlyJsonValidationErrors($errors, $responseKey = 'errors')
989
989
990
990
$ jsonErrors = Arr::get ($ this ->json (), $ responseKey ) ?? [];
991
991
992
- $ expectedErrorKeys = collect ($ errors )->map (fn ($ value , $ key ) => is_int ($ key ) ? $ value : $ key )->all ();
992
+ $ expectedErrorKeys = (new Collection ($ errors ))
993
+ ->map (fn ($ value , $ key ) => is_int ($ key ) ? $ value : $ key )
994
+ ->all ();
993
995
994
996
$ unexpectedErrorKeys = Arr::except ($ jsonErrors , $ expectedErrorKeys );
995
997
996
- PHPUnit::withResponse ($ this )->assertTrue (count ($ unexpectedErrorKeys ) === 0 , 'Response has unexpected validation errors: ' .collect ($ unexpectedErrorKeys )->keys ()->map (fn ($ key ) => "' {$ key }' " )->join (', ' ));
998
+ PHPUnit::withResponse ($ this )->assertTrue (
999
+ count ($ unexpectedErrorKeys ) === 0 ,
1000
+ 'Response has unexpected validation errors: ' .(new Collection ($ unexpectedErrorKeys ))->keys ()->map (fn ($ key ) => "' {$ key }' " )->join (', ' )
1001
+ );
997
1002
998
1003
return $ this ;
999
1004
}
@@ -1398,14 +1403,15 @@ public function assertOnlyInvalid($errors = null, $errorBag = 'default', $respon
1398
1403
->getBag ($ errorBag )
1399
1404
->getMessages ();
1400
1405
1401
- $ expectedErrorKeys = collect ($ errors )
1402
- ->map (fn ($ value , $ key ) => is_int ($ key ) ? $ value : $ key )->all ();
1406
+ $ expectedErrorKeys = (new Collection ($ errors ))
1407
+ ->map (fn ($ value , $ key ) => is_int ($ key ) ? $ value : $ key )
1408
+ ->all ();
1403
1409
1404
1410
$ unexpectedErrorKeys = Arr::except ($ sessionErrors , $ expectedErrorKeys );
1405
1411
1406
1412
PHPUnit::withResponse ($ this )->assertTrue (
1407
1413
count ($ unexpectedErrorKeys ) === 0 ,
1408
- 'Response has unexpected validation errors: ' .collect ( $ unexpectedErrorKeys )->keys ()->map (fn ($ key ) => "' {$ key }' " )->join (', ' )
1414
+ 'Response has unexpected validation errors: ' .( new Collection ( $ unexpectedErrorKeys) )->keys ()->map (fn ($ key ) => "' {$ key }' " )->join (', ' )
1409
1415
);
1410
1416
1411
1417
return $ this ;
0 commit comments