You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
639 B

2 years ago
  1. <?php
  2. namespace Tests\iLaravel\Policies;
  3. use App\Models\ILaravel;
  4. use Tests\Bootstrap;
  5. class GroupPolicyTest extends Bootstrap
  6. {
  7. function test_group_policy_successful()
  8. {
  9. $this->modelWithPolicy('ilaravels', ['group'])
  10. ->loginAs()
  11. ->getJson(route('api.ilaravels.show', $this->one(ILaravel::class)))
  12. ->assertOk();
  13. }
  14. function test_group_policy_fail()
  15. {
  16. $this->modelWithPolicy('ilaravels', ['group'])
  17. ->loginAs()
  18. ->getJson(route('api.ilaravels.show', $this->one(ILaravel::class, ['group_id' => 0])))
  19. ->assertForbidden();
  20. }
  21. }