/** * Test assigning of permissions for the administrator role. */ function testAdministratorRole() { $this->drupalLogin($this->admin_user); $this->drupalGet('admin/config/people/accounts'); // Verify that the administration role is none by default. $this->assertOptionSelected('edit-user-admin-role', '', 'Administration role defaults to none.'); // Set the user's role to be the administrator role. $edit = array(); $edit['user_admin_role'] = $this->rid; $this->drupalPostForm('admin/config/people/accounts', $edit, t('Save configuration')); // Enable aggregator module and ensure the 'administer news feeds' // permission is assigned by default. \Drupal::ModuleHandler()->install(array('aggregator')); $this->assertTrue($this->admin_user->hasPermission('administer news feeds'), 'The permission was automatically assigned to the administrator role'); }