function AccessDeniedTest::setUp

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/System/AccessDeniedTest.php \Drupal\Tests\system\Functional\System\AccessDeniedTest::setUp()
  2. 10 core/modules/system/tests/src/Functional/System/AccessDeniedTest.php \Drupal\Tests\system\Functional\System\AccessDeniedTest::setUp()
  3. 11.x core/modules/system/tests/src/Functional/System/AccessDeniedTest.php \Drupal\Tests\system\Functional\System\AccessDeniedTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/system/tests/src/Functional/System/AccessDeniedTest.php, line 33

Class

AccessDeniedTest
Tests page access denied functionality, including custom 403 pages.

Namespace

Drupal\Tests\system\Functional\System

Code

protected function setUp() {
    parent::setUp();
    $this->drupalPlaceBlock('page_title_block');
    // Create an administrative user.
    $this->adminUser = $this->drupalCreateUser([
        'access administration pages',
        'administer site configuration',
        'link to any page',
        'administer blocks',
    ]);
    $this->adminUser->roles[] = 'administrator';
    $this->adminUser
        ->save();
    user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, [
        'access user profiles',
    ]);
    user_role_grant_permissions(RoleInterface::AUTHENTICATED_ID, [
        'access user profiles',
    ]);
}

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