You are here

protected function FrontPageTest::setUp in Drupal 9

Same name in this branch
  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()
Same name and namespace in other branches
  1. 8 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 33

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