function UserPermissionsTest::setUp

Same name in this branch
  1. 9 core/modules/user/tests/src/FunctionalJavascript/UserPermissionsTest.php \Drupal\Tests\user\FunctionalJavascript\UserPermissionsTest::setUp()
Same name in other branches
  1. 8.9.x core/modules/user/tests/src/Functional/UserPermissionsTest.php \Drupal\Tests\user\Functional\UserPermissionsTest::setUp()
  2. 10 core/modules/user/tests/src/FunctionalJavascript/UserPermissionsTest.php \Drupal\Tests\user\FunctionalJavascript\UserPermissionsTest::setUp()
  3. 10 core/modules/user/tests/src/Functional/UserPermissionsTest.php \Drupal\Tests\user\Functional\UserPermissionsTest::setUp()
  4. 11.x core/modules/user/tests/src/FunctionalJavascript/UserPermissionsTest.php \Drupal\Tests\user\FunctionalJavascript\UserPermissionsTest::setUp()
  5. 11.x 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 38

Class

UserPermissionsTest
Verifies 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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.