vendredi 31 juillet 2020

Laravel nova basic testing gives 403

I'm writing my first functional tests with Laravel Nova.

Here is my

/** @test **/
    public function super_admin_has_ui_access()
    {
    $this->user = factory(\App\User::class)->create(['profile_id' => 1, 'company_id' => 1, 'operation_id' => 1,]);
    $this->actingAs($this->user);
        $this->user->update(['email' =>'julien@email.fr',  'profile_id' => 1]);
        $response = $this->get('/nova-api/users/1');

        $response->assertStatus(200);
    }

    $this->user = factory(\App\User::class)->create(['profile_id' => 1, 'company_id' => 1, 'operation_id' => 1,]);
    $this->actingAs($this->user);

But nova is getting me:

Expected status code 200 but received 403.
Failed asserting that 200 is identical to 403.

When I try manually to log with this user (superadmin ), I can access this url.

Is there something I have to configure with phpunit ?

Aucun commentaire:

Enregistrer un commentaire