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.

26 lines
596 B

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