Skip to content

Commit

Permalink
Support 'authenticated' as role name for authenticated user role
Browse files Browse the repository at this point in the history
Drupal 8 now throws an exception when trying to assign this role, I have a lot of 'authenticated' in my tests as that is the machine name and other role machine names are supported too, so doing this is consistent I think.

Also lower cased it, because the actual role name is 'Authenticated user'.

Please also backport this to 1.0, as I'm still using that.
  • Loading branch information
Berdir committed Dec 23, 2014
1 parent 9509b76 commit f836675
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Drupal/DrupalExtension/Context/DrupalContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function assertAuthenticatedByRole($role) {
$roles = explode(',', $role);
$roles = array_map('trim', $roles);
foreach ($roles as $role) {
if ($role != 'authenticated user') {
if (!in_array(strtolower($role), ['authenticated', 'authenticated user'])) {
// Only add roles other than 'authenticated user'.
$this->getDriver()->userAddRole($user, $role);
}
Expand Down

0 comments on commit f836675

Please sign in to comment.