Support the ongoing development of Laravel.io →
Session Validation Testing

Hi. I have problem with functional testing form validation. When I use $errors in my view, tests fail, because it cannot see errors. But if I add following snippet to my view (ugly, but works):

{{ $errors=Session::get('errors', new \Illuminate\Support\MessageBag) }}

It then works. How to fix it in prettier way?

EDIT: putting View::share('errors', Session::get('errors', new \Illuminate\Support\MessageBag)); to app/start/testing.php doesn't fix this.

Last updated 3 years ago.
0

Sign in to participate in this thread!

PHPverse

Your banner here too?

Cysioland cysioland Joined 26 Mar 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.