function SiteMaintenanceTest::setUp

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

Overrides BrowserTestBase::setUp

File

core/modules/system/tests/src/Functional/System/SiteMaintenanceTest.php, line 44

Class

SiteMaintenanceTest
Tests access to site while in maintenance mode.

Namespace

Drupal\Tests\system\Functional\System

Code

protected function setUp() : void {
    parent::setUp();
    // Configure 'node' as front page.
    $this->config('system.site')
        ->set('page.front', '/node')
        ->save();
    $this->config('system.performance')
        ->set('js.preprocess', 1)
        ->save();
    // Create a user allowed to access site in maintenance mode.
    $this->user = $this->drupalCreateUser([
        'access site in maintenance mode',
    ]);
    // Create an administrative user.
    $this->adminUser = $this->drupalCreateUser([
        'administer site configuration',
        'access site in maintenance mode',
    ]);
    $this->drupalLogin($this->adminUser);
}

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