UserAccessTest.php
1.01 KB
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
<?php
use Tests\BrowserKitTestCase;
/**
 * Class UserAccessTest.
 */
class UserAccessTest extends BrowserKitTestCase
{
    public function testUserCantAccessAdminDashboard()
    {
        $this->visit('/')
             ->actingAs($this->user)
             ->visit('/admin/dashboard')
             ->seePageIs('/dashboard')
             ->see('You do not have access to do that.');
    }
    public function testExecutiveCanAccessAdminDashboard()
    {
        $this->visit('/')
             ->actingAs($this->executive)
             ->visit('/admin/dashboard')
             ->seePageIs('/admin/dashboard')
             ->see($this->executive->name);
    }
    public function testExecutiveCantAccessManageRoles()
    {
        $this->visit('/')
             ->actingAs($this->executive)
             ->visit('/admin/dashboard')
             ->seePageIs('/admin/dashboard')
             ->visit('/admin/access/role')
             ->seePageIs('/admin/dashboard')
             ->see('You do not have access to do that.');
    }
}