modelWithPolicy('ilaravels', ['owner']) ->loginAs([], $user = $this->one(UserDocument::class)) ->getJson(route('api.ilaravels.show', $this->one(ILaravel::class, ['user_id' => $user->id]))) ->assertOk(); } function test_owner_policy_fail() { $this->modelWithPolicy('ilaravels', ['owner']) ->loginAs() ->getJson(route('api.ilaravels.show', $this->one(ILaravel::class))) ->assertForbidden(); } }