diff --git a/src/Illuminate/Testing/TestResponse.php b/src/Illuminate/Testing/TestResponse.php index 4851b175c885..c0a468a7d0f0 100644 --- a/src/Illuminate/Testing/TestResponse.php +++ b/src/Illuminate/Testing/TestResponse.php @@ -994,6 +994,8 @@ public function assertOnlyJsonValidationErrors($errors, $responseKey = 'errors') $unexpectedErrorKeys = Arr::except($jsonErrors, $expectedErrorKeys); PHPUnit::withResponse($this)->assertTrue(count($unexpectedErrorKeys) === 0, 'Response has unexpected validation errors: '.collect($unexpectedErrorKeys)->keys()->map(fn ($key) => "'{$key}'")->join(', ')); + + return $this; } /**