-
-
Notifications
You must be signed in to change notification settings - Fork 383
/
Copy pathPermissionsAsGatesTest.php
39 lines (28 loc) · 1.01 KB
/
PermissionsAsGatesTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
declare(strict_types=1);
namespace Laratrust\Tests;
use Laratrust\LaratrustServiceProvider;
use Illuminate\Contracts\Auth\Access\Gate;
class PermissionsAsGatesTest extends LaratrustTestCase
{
public function testRegistersPermissionsAsGates()
{
config()->set('laratrust.permissions_as_gates', true);
$this->mock(Gate::class)->shouldReceive('before')->once();
$provider = new LaratrustServiceProvider($this->app);
$provider->boot();
}
public function testDoesNotRegisterPermissionsAsGatesIfDisabledInConfig()
{
config()->set('laratrust.permissions_as_gates', false);
$this->mock(Gate::class)->shouldNotReceive('before');
$provider = new LaratrustServiceProvider($this->app);
$provider->boot();
}
public function testDoesNotRegisterPermissionsAsGatesByDefault()
{
$this->mock(Gate::class)->shouldNotReceive('before');
$provider = new LaratrustServiceProvider($this->app);
$provider->boot();
}
}