hasRole() public method

Return if the account has a certain role
public hasRole ( Role $role ) : boolean
$role Neos\Flow\Security\Policy\Role
return boolean
 /**
  * @test
  */
 public function hasRoleReturnsFalseForAssignedButNonExistentRole()
 {
     $this->inject($this->account, 'roleIdentifiers', ['Acme.Demo:NoLongerThere', $this->administratorRole->getIdentifier()]);
     $this->assertTrue($this->account->hasRole($this->administratorRole));
     $this->assertFalse($this->account->hasRole(new Role('Acme.Demo:NoLongerThere')));
 }
 /**
  * Removes the specified role from the given account and potentially carries out further actions which are needed to
  * properly reflect these changes.
  *
  * @param Account $account The account to remove roles from
  * @param string $roleIdentifier A fully qualified role identifier, or a role identifier relative to the Neos.Neos namespace
  * @return integer How often this role has been removed from the given account (effectively can be 1 or 0)
  * @api
  */
 public function removeRoleFromAccount(Account $account, $roleIdentifier)
 {
     $roleIdentifier = $this->normalizeRoleIdentifier($roleIdentifier);
     $role = $this->policyService->getRole($roleIdentifier);
     /** @var Account $account */
     if ($account->hasRole($role)) {
         $account->removeRole($role);
         $this->accountRepository->update($account);
         $this->emitRolesRemoved($account, array($role));
         return 1;
     }
     return 0;
 }