function FrontPageTest::setUp

Same name in this branch
  1. 11.x core/modules/node/tests/src/Functional/Views/FrontPageTest.php \Drupal\Tests\node\Functional\Views\FrontPageTest::setUp()
Same name in other branches
  1. 9 core/modules/node/tests/src/Functional/Views/FrontPageTest.php \Drupal\Tests\node\Functional\Views\FrontPageTest::setUp()
  2. 9 core/modules/system/tests/src/Functional/System/FrontPageTest.php \Drupal\Tests\system\Functional\System\FrontPageTest::setUp()
  3. 8.9.x core/modules/node/tests/src/Functional/Views/FrontPageTest.php \Drupal\Tests\node\Functional\Views\FrontPageTest::setUp()
  4. 8.9.x core/modules/system/tests/src/Functional/System/FrontPageTest.php \Drupal\Tests\system\Functional\System\FrontPageTest::setUp()
  5. 10 core/modules/node/tests/src/Functional/Views/FrontPageTest.php \Drupal\Tests\node\Functional\Views\FrontPageTest::setUp()
  6. 10 core/modules/system/tests/src/Functional/System/FrontPageTest.php \Drupal\Tests\system\Functional\System\FrontPageTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/system/tests/src/Functional/System/FrontPageTest.php, line 36

Class

FrontPageTest
Tests front page functionality and administration.

Namespace

Drupal\Tests\system\Functional\System

Code

protected function setUp() : void {
    parent::setUp();
    // Create admin user, log in admin user, and create one node.
    $this->drupalLogin($this->drupalCreateUser([
        'access content',
        'administer site configuration',
    ]));
    $this->drupalCreateContentType([
        'type' => 'page',
    ]);
    $this->nodePath = "node/" . $this->drupalCreateNode([
        'promote' => 1,
    ])
        ->id();
    // Configure 'node' as front page.
    $this->config('system.site')
        ->set('page.front', '/node')
        ->save();
    // Enable front page logging in system_test.module.
    \Drupal::state()->set('system_test.front_page_output', 1);
}

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