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.

24 lines
589 B

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