1 user.test UserPermissionsTestCase::testAdministratorRole()

Test assigning of permissions for the administrator role.

File

core/modules/user/tests/user.test, line 1407
Tests for user.module.

Class

UserPermissionsTestCase

Code

function testAdministratorRole() {
  $this->backdropLogin($this->admin_user);
  $this->backdropGet('admin/config/people/roles');

  // Set the user's role to be the administrator role.
  $edit = array();
  $edit['user_admin_role'] = $this->admin_role_name;
  $this->backdropPost('admin/config/people/roles', $edit, t('Save configuration'));

  // Enable book module and ensure the 'administer book outlines' permission
  // is assigned by default.
  $edit = array();
  $edit['modules[System][book][enable]'] = TRUE;
  $this->backdropPost('admin/modules', $edit, t('Save configuration'));
  backdrop_static_reset('user_roles');
  $this->assertTrue(user_access('administer book outlines', $this->admin_user), 'The permission was automatically assigned to the administrator role');
}