modelWithPolicy('ilaravels', ['model:policyCheckCustom']) ->getJson(route('api.ilaravels.show', $this->one(ILaravel::class))) ->assertOk(); } public function test_custom_method_policy_fail() { $mokModel = $this->mockModel(ILaravel::class); $mokModel->shouldReceive('resolveRouteBinding')->andReturnSelf(); $mokModel->shouldReceive('policyCheckCustom')->andReturnFalse(); $this->modelWithPolicy('ilaravels', ['model:policyCheckCustom']) ->getJson(route('api.ilaravels.show', $this->one(ILaravel::class))) ->assertForbidden(); } }