Nevermind, I was using WithoutMiddleware. If anyone stumbles upon this, I found the answer to my problem via the link below.
http://stackoverflow.com/questions/33588327/laravel-5-1-phpunit-form-testing-fails-everytime
I'm running into a bit of a bump trying to test form validation via PHPunit, using some of the built in Laravel testing methods. In my use case, I want to make sure that the proper error is showing if two dates on the form are the same. The test is pretty simple.
$now = Carbon\Carbon::now()->format('Y-m-d');
$this->visit('/path/to/form')
->type($now, 'start_date')
->type($now, 'end_date')
->press('submit')
->see('The start date and end date must be different.');`
I've run through this in the browser and the validation works properly. However when I run the test, I get the following error.
exception 'ErrorException' with message 'Undefined variable: errors' in /path/to/checkout/storage/framework/views/3ee630b8dd66e4e096426d3f6dc0efd6
I assume it's just a matter of setting the error bag as a session variable in the test environment, but I can't figure out how to do it.
Thanks in advance!
Please or to participate in this conversation.