PHP Class Artesaos\Defender\Testing\EloquentPermissionRepositoryTest

Inheritance: extends AbstractTestCase
Datei anzeigen Open project: artesaos/defender

Protected Properties

Property Type Description
$providers array Array of service providers.

Public Methods

Method Description
setUp ( )
testShouldAttachPermissionToRole ( ) Testing if permission is attached to role.
testShouldCreatePermission ( ) Testing the criation of permissions.
testUserShouldHasPermissionsTrait ( ) Asserting if the User model has traits.

Protected Methods

Method Description
createAndAttachPermission ( string $permission, User | array $user, string $readableName = null ) : array Create and Attach a Permission to User.
createAndAttachPermissionToRole ( string $permission, Artesaos\Defender\Role $role, string $readableName = null ) : array Create and Attach a Permission to User.
createPermission ( string $name, string $readableName = null ) : Artesaos\Defender\Permission Create a permission and assert to see in database.
notSeePermissionAttachedToRoleInDatabase ( Artesaos\Defender\Permission $permission, Artesaos\Defender\Role $role ) Assert to not see in Database a Permission attached to Role.
notSeePermissionAttachedToUserInDatabase ( Artesaos\Defender\Permission $permission, User $user ) Assert to not see in Database a Permission attached to User.
seePermissionAttachedToRoleInDatabase ( Artesaos\Defender\Permission $permission, Artesaos\Defender\Role $role ) Assert to see in Database a Permission attached to Role.
seePermissionAttachedToUserInDatabase ( Artesaos\Defender\Permission $permission, User $user ) Assert to see in Database a Permission attached to User.

Method Details

createAndAttachPermission() protected method

Create and Attach a Permission to User.
protected createAndAttachPermission ( string $permission, User | array $user, string $readableName = null ) : array
$permission string
$user User | array User or array of where clausules.
$readableName string Permission readable name.
return array Array containing created $permission and $user.

createAndAttachPermissionToRole() protected method

Create and Attach a Permission to User.
protected createAndAttachPermissionToRole ( string $permission, Artesaos\Defender\Role $role, string $readableName = null ) : array
$permission string
$role Artesaos\Defender\Role Role or array of where clausules.
$readableName string Permission readable name.
return array Array containing created $permission and $role.

createPermission() protected method

Create a permission and assert to see in database.
protected createPermission ( string $name, string $readableName = null ) : Artesaos\Defender\Permission
$name string
$readableName string
return Artesaos\Defender\Permission

notSeePermissionAttachedToRoleInDatabase() protected method

Assert to not see in Database a Permission attached to Role.
protected notSeePermissionAttachedToRoleInDatabase ( Artesaos\Defender\Permission $permission, Artesaos\Defender\Role $role )
$permission Artesaos\Defender\Permission
$role Artesaos\Defender\Role

notSeePermissionAttachedToUserInDatabase() protected method

Assert to not see in Database a Permission attached to User.
protected notSeePermissionAttachedToUserInDatabase ( Artesaos\Defender\Permission $permission, User $user )
$permission Artesaos\Defender\Permission
$user User

seePermissionAttachedToRoleInDatabase() protected method

Assert to see in Database a Permission attached to Role.
protected seePermissionAttachedToRoleInDatabase ( Artesaos\Defender\Permission $permission, Artesaos\Defender\Role $role )
$permission Artesaos\Defender\Permission
$role Artesaos\Defender\Role

seePermissionAttachedToUserInDatabase() protected method

Assert to see in Database a Permission attached to User.
protected seePermissionAttachedToUserInDatabase ( Artesaos\Defender\Permission $permission, User $user )
$permission Artesaos\Defender\Permission
$user User

setUp() public method

public setUp ( )

testShouldAttachPermissionToRole() public method

Testing if permission is attached to role.

testShouldCreatePermission() public method

Testing the criation of permissions.

testUserShouldHasPermissionsTrait() public method

Asserting if the User model has traits.

Property Details

$providers protected_oe property

Array of service providers.
protected array $providers
return array