/**
  * Prepares and validates the included roles
  *
  * @param array $roleCollection
  *
  * @return array
  */
 private function prepareIncludedRoles(array $roleCollection)
 {
     $roleHelper = new RoleNameHelper();
     foreach ($roleCollection as $role => &$configuration) {
         try {
             if (!isset($configuration["included_roles"]) || !is_array($configuration["included_roles"])) {
                 continue;
             }
             $configuration["included_roles"] = array_map(function ($includedRole) use($roleHelper, $roleCollection, $role) {
                 $normalizedRoleName = $roleHelper->normalizeRoleName($includedRole);
                 if (!isset($roleCollection[$normalizedRoleName])) {
                     throw new UnknownRoleException("The included role „{$normalizedRoleName}” (in the definition of role “{$role}”) was not found.");
                 }
                 return $normalizedRoleName;
             }, $configuration["included_roles"]);
         } catch (\InvalidArgumentException $e) {
             throw new EmptyRoleNameException("Role name could not be normalized: {$e->getMessage()}.", 0, $e);
         }
     }
     return $roleCollection;
 }
 /**
  * @expectedException \InvalidArgumentException
  */
 public function testRoleWithOnlyWhitespace()
 {
     $helper = new RoleNameHelper();
     $helper->normalizeRoleName("   ");
 }