diff --git a/tests/GateTest.php b/tests/GateTest.php index 93359834..436900b8 100644 --- a/tests/GateTest.php +++ b/tests/GateTest.php @@ -19,6 +19,19 @@ public function it_allows_other_gate_before_callbacks_to_run_if_a_user_does_not_ $this->assertFalse($this->testUser->can('edit-articles')); app(Gate::class)->before(function () { + // this Gate-before intercept overrides everything to true ... like a typical Super-Admin might use + return true; + }); + + $this->assertTrue($this->testUser->can('edit-articles')); + } + + /** @test */ + public function it_allows_gate_after_callback_to_grant_denied_privileges() + { + $this->assertFalse($this->testUser->can('edit-articles')); + + app(Gate::class)->after(function ($user, $ability, $result) { return true; });