protected function ScheduledUpdatesTestBase::grantPermissionsToUser in Scheduled Updates 8
Grant permissions to a user.
The permissions are actually added to the users role. Relies on test users only having 1 non-locked role.
Parameters
array $permissions:
1 call to ScheduledUpdatesTestBase::grantPermissionsToUser()
- EmbeddedScheduledUpdateTypeTestBase::checkAfterTypeCreated in tests/
src/ FunctionalJavascript/ EmbeddedScheduledUpdateTypeTestBase.php
File
- tests/
src/ FunctionalJavascript/ ScheduledUpdatesTestBase.php, line 259 - Contains \Drupal\Tests\scheduled_updates\ScheduledUpdatesTestBase.
Class
- ScheduledUpdatesTestBase
- Define base class for Scheduled Updates Tests
Namespace
Drupal\Tests\scheduled_updates\FunctionalJavascriptCode
protected function grantPermissionsToUser($permissions) {
$roles = $this->adminUser
->getRoles(TRUE);
$this
->assert('debug', "roles =" . implode(',', $roles));
$role_id = array_pop($roles);
/** @var \Drupal\user\RoleInterface $role */
$role = Role::load($role_id);
$this
->grantPermissions($role, $permissions);
}