function NavigationTopBarTest::setUp

Same name in other branches
  1. 11.x core/modules/navigation/tests/src/Functional/NavigationTopBarTest.php \Drupal\Tests\navigation\Functional\NavigationTopBarTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/navigation/tests/src/Functional/NavigationTopBarTest.php, line 50

Class

NavigationTopBarTest
Tests the top bar functionality.

Namespace

Drupal\Tests\navigation\Functional

Code

protected function setUp() : void {
    parent::setUp();
    // Create and log in an administrative user.
    $this->adminUser = $this->drupalCreateUser([
        'administer site configuration',
        'access administration pages',
        'access navigation',
        'bypass node access',
    ]);
    $this->drupalLogin($this->adminUser);
    // Create a new content type and enable Layout Builder for it.
    $node_type = $this->createContentType([
        'type' => 'node_type',
    ]);
    LayoutBuilderEntityViewDisplay::load('node.node_type.default')->enableLayoutBuilder()
        ->setOverridable()
        ->save();
    // Place the tabs block to check its presence.
    $this->drupalPlaceBlock('local_tasks_block', [
        'id' => 'tabs',
    ]);
    // Enable some test blocks.
    $this->node = $this->drupalCreateNode([
        'type' => $node_type->id(),
    ]);
}

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