You are here

protected function UserPermissionsTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/user/tests/src/Functional/UserPermissionsTest.php \Drupal\Tests\user\Functional\UserPermissionsTest::setUp()
  2. 10 core/modules/user/tests/src/Functional/UserPermissionsTest.php \Drupal\Tests\user\Functional\UserPermissionsTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/user/tests/src/Functional/UserPermissionsTest.php, line 36

Class

UserPermissionsTest
Verify that role permissions can be added and removed via the permissions page.

Namespace

Drupal\Tests\user\Functional

Code

protected function setUp() : void {
  parent::setUp();
  $this->adminUser = $this
    ->drupalCreateUser([
    'administer permissions',
    'access user profiles',
    'administer site configuration',
    'administer modules',
    'administer account settings',
  ]);

  // Find the new role ID.
  $all_rids = $this->adminUser
    ->getRoles();
  unset($all_rids[array_search(RoleInterface::AUTHENTICATED_ID, $all_rids)]);
  $this->rid = reset($all_rids);
}