Bristol SU Support Package
src
Testing
HandlesAuthentication.php
Go to the documentation of this file.
1
<?php
2
3
namespace
BristolSU\Support\Testing
;
4
5
use
BristolSU\ControlDB\Contracts\Models\Group
;
6
use
BristolSU\ControlDB\Contracts\Models\Role
;
7
use
BristolSU\ControlDB\Contracts\Models\User
;
8
use
BristolSU\Support\Authentication\Contracts\Authentication
;
9
use
BristolSU\Support\Testing\Authentication\SessionAuthentication
;
10
14
trait
HandlesAuthentication
15
{
16
23
public
function
newUser
($attributes = [])
24
{
25
return
factory(\
BristolSU
\ControlDB\Models\User::class)->create($attributes);
26
}
27
34
public
function
newGroup
($attributes = [])
35
{
36
return
factory(\
BristolSU
\ControlDB\Models\Group::class)->create($attributes);
37
}
38
45
public
function
newRole
($attributes = [])
46
{
47
return
factory(\
BristolSU
\ControlDB\Models\Role::class)->create($attributes);
48
}
49
57
public
function
beGroup
(Group $group)
58
{
59
app()->make(Authentication::class)->setGroup($group);
60
}
61
69
public
function
beRole
(Role $role)
70
{
71
app()->make(Authentication::class)->setRole($role);
72
}
73
74
82
public
function
beUser
(User $user)
83
{
84
app()->make(Authentication::class)->setUser($user);
85
}
86
87
}
BristolSU\Support\Testing\HandlesAuthentication\beGroup
beGroup(Group $group)
Definition:
HandlesAuthentication.php:57
BristolSU
User
BristolSU\Support\Testing\HandlesAuthentication\newUser
newUser($attributes=[])
Definition:
HandlesAuthentication.php:23
BristolSU\Support\Testing\HandlesAuthentication\newGroup
newGroup($attributes=[])
Definition:
HandlesAuthentication.php:34
Group
BristolSU\Support\Testing
SessionAuthentication
BristolSU\Support\Testing\HandlesAuthentication\newRole
newRole($attributes=[])
Definition:
HandlesAuthentication.php:45
BristolSU\Support\Testing\HandlesAuthentication
Definition:
HandlesAuthentication.php:14
BristolSU\Support\Testing\HandlesAuthentication\beUser
beUser(User $user)
Definition:
HandlesAuthentication.php:82
Role
Authentication
BristolSU\Support\Testing\HandlesAuthentication\beRole
beRole(Role $role)
Definition:
HandlesAuthentication.php:69
Generated by
1.8.13