withHeader('Accept-Language', 'es-AR,es;q=0.9') ->postJson('/api/login') ->assertUnprocessable() ->assertHeader('Content-Language', 'es') ->assertJsonPath('errors.email.0', 'El campo email es obligatorio.') ->assertJsonPath('errors.password.0', 'El campo contraseƱa es obligatorio.'); } public function test_it_negotiates_english_from_accept_language(): void { $this->withHeader('Accept-Language', 'en-US,en;q=0.9') ->postJson('/api/login') ->assertUnprocessable() ->assertHeader('Content-Language', 'en') ->assertJsonPath('errors.email.0', 'The email field is required.') ->assertJsonPath('errors.password.0', 'The password field is required.'); } public function test_it_localizes_framework_error_responses(): void { $this->withHeader('Accept-Language', 'en') ->getJson('/api/route-that-does-not-exist') ->assertNotFound() ->assertHeader('Content-Language', 'en') ->assertJson([ 'code' => 'errors.not_found', 'message' => 'The requested resource was not found.', ]); } }