AuthHandlesAuthorizationTest.php 881 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace Illuminate\Tests\Auth;
  3. use Illuminate\Auth\Access\HandlesAuthorization;
  4. use PHPUnit\Framework\TestCase;
  5. class AuthHandlesAuthorizationTest extends TestCase
  6. {
  7. use HandlesAuthorization;
  8. public function testAllowMethod()
  9. {
  10. $response = $this->allow('some message', 'some_code');
  11. $this->assertTrue($response->allowed());
  12. $this->assertFalse($response->denied());
  13. $this->assertSame('some message', $response->message());
  14. $this->assertSame('some_code', $response->code());
  15. }
  16. public function testDenyMethod()
  17. {
  18. $response = $this->deny('some message', 'some_code');
  19. $this->assertTrue($response->denied());
  20. $this->assertFalse($response->allowed());
  21. $this->assertSame('some message', $response->message());
  22. $this->assertSame('some_code', $response->code());
  23. }
  24. }