-
Notifications
You must be signed in to change notification settings - Fork 11.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't throw exception from ->deny() and set the gate response on the …
…exception.
- Loading branch information
Showing
6 changed files
with
95 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace Illuminate\Tests\Auth; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Illuminate\Auth\Access\HandlesAuthorization; | ||
|
||
class AuthHandlesAuthorizationTest extends TestCase | ||
{ | ||
use HandlesAuthorization; | ||
|
||
public function test_allow_method() | ||
{ | ||
$response = $this->allow('some message', 'some_code'); | ||
|
||
$this->assertTrue($response->allowed()); | ||
$this->assertFalse($response->denied()); | ||
$this->assertEquals('some message', $response->message()); | ||
$this->assertEquals('some_code', $response->code()); | ||
} | ||
|
||
public function test_deny_method() | ||
{ | ||
$response = $this->deny('some message', 'some_code'); | ||
|
||
$this->assertTrue($response->denied()); | ||
$this->assertFalse($response->allowed()); | ||
$this->assertEquals('some message', $response->message()); | ||
$this->assertEquals('some_code', $response->code()); | ||
} | ||
} |