Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

brlebtag's avatar

Can't fix TokenMismatchException

I have the following test:

public function test___armazenar___usuario_autenticado___form_criar_novo_usuario()
    {
        //
        //  Setting up
        //
        $model = $this->criarModel();
        
        $this->app->instance('UsuarioModel', $model);

        Session::start();

        //
        // Visiting and Asserting...
        //
        $this->actingAs(Usuario::find(1))
            ->post('usuario', ["_token" => csrf_token()])
            ->withSession(['status' => trans('geral.sucesso')])
            ->seePageIs('/')
            ->seeStatusCode(302)
            ;
    }

I can't fix TokenMismatchException.

Any ideias?

0 likes
1 reply

Please or to participate in this conversation.