dillscher's avatar

How to test forms with phpunit without removing CSRF-Middleware?

Hi folks,

currently I'm stuck here trying to use laravel 5.1 integrated tests to check some forms. As there is the CSRF-verification I had to temporarily comment the middleware \App\Http\Middleware\VerifyCsrfToken::class to get rid of token mismatches.

But as I want to be sure to not forget this kind of protection on deployment to production it seems to be a risky way.

So, is there any smart solution to solve this on 5.1 for tests?

Maybe I just did not stumble upon the right solution yet.

Kind regards,

Christian

0 likes
2 replies
dillscher's avatar

Oh my, must have been blind and it refers once again to RTFM ;-).

Please or to participate in this conversation.