I'm gonna make a Unit Testing for my resource. Here my testing function below :
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!"]);
}
But it was return 403. I expected to return 201 as I login normally to Nova dashboard and create new record in the form. It seems like forbidden to access the route inside Testing Class. Is there anyway to access the route ? Please any body help me to solve this.