Nova Laravel单元测试预期返回201,但返回403
我要对我的资源进行单元测试。 下面是我的测试功能:Nova Laravel单元测试预期返回201,但返回403,laravel,unit-testing,phpunit,laravel-nova,laravel-unit-test,Laravel,Unit Testing,Phpunit,Laravel Nova,Laravel Unit Test,我要对我的资源进行单元测试。 下面是我的测试功能: public function testCreateMyResource() { $user = factory(\App\User::class)->states('admin')->create(); $this->actingAs($user); $data = [ 'Field' => "Example", ]; $response =
public function testCreateMyResource()
{
$user = factory(\App\User::class)->states('admin')->create();
$this->actingAs($user);
$data = [
'Field' => "Example",
];
$response = $this->actingAs($user)->postJson('/nova-api/my-resource?editing=true&editMode=create',$data);
$response->assertStatus(201);
$response->assertJson(['status' => true]);
$response->assertJson(['message' => "Created!"]);
}
但它是返回403。
当我正常登录Nova dashboard并在表单中创建新记录时,我希望返回201。
似乎禁止访问测试类内部的路由。
这条路线还有路可走吗?请任何人帮我解决这个问题