function UserPermissionsTest::testAdministratorRole

Test assigning of permissions for the administrator role.

File

drupal/core/modules/user/lib/Drupal/user/Tests/UserPermissionsTest.php, line 67
Definition of Drupal\user\Tests\UserPermissionsTest.

Class

UserPermissionsTest

Namespace

Drupal\user\Tests

Code

function testAdministratorRole() {
  $this
    ->drupalLogin($this->admin_user);
  $this
    ->drupalGet('admin/config/people/accounts');

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

  // Enable aggregator module and ensure the 'administer news feeds'
  // permission is assigned by default.
  $edit = array();
  $edit['modules[Core][aggregator][enable]'] = TRUE;

  // Aggregator depends on file module, enable that as well.
  $edit['modules[Core][file][enable]'] = TRUE;
  $this
    ->drupalPost('admin/modules', $edit, t('Save configuration'));
  $this
    ->assertTrue(user_access('administer news feeds', $this->admin_user), 'The permission was automatically assigned to the administrator role');
}