Laravel Nova基本测试给出了403

时间:2020-07-31 16:58:30

标签: laravel testing laravel-nova

我正在用Laravel Nova编写我的第一个功能测试。

这是我的

/** @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);

但是nova正在吸引我

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

当我尝试手动使用该用户(superadmin)登录时,我可以访问该URL。

是否需要使用phpunit配置一些东西?

0 个答案:

没有答案