sebastiansulinski's avatar

Test form with CSRF token in meta tag

I'm trying to write a test that checks for a response, but my forms are submitted via ajax using jQuery and csrf token is fetched from the meta tag, which is included on each page.

Is there a way to add the token to the test call? What I have so far is:

$this->visit('register')
        ->type('non email value', 'email')
        ->press('REGISTER');

$this->see('Invalid email address');
0 likes
3 replies
sebastiansulinski's avatar

Thanks @zachleigh. This will work for this specific scenario, but what if I wanted to test the form for middleware, but without sending the csrf with the php request token?

Please or to participate in this conversation.