public removeRole ( |
||
$role | ||
return | void |
public function removeRole(Role $role)
{
$this->initializeRoles();
if ($this->hasRole($role)) {
$roleIdentifier = $role->getIdentifier();
unset($this->roles[$roleIdentifier]);
$identifierIndex = array_search($roleIdentifier, $this->roleIdentifiers);
unset($this->roleIdentifiers[$identifierIndex]);
}
}
/** * @test */ public function removeRoleSkipsRemovalIfRoleNotAssigned() { $this->account->setRoles([$this->administratorRole]); $this->account->removeRole($this->customerRole); $this->assertCount(1, $this->account->getRoles()); }