function LayoutBuilderOverridesTest::testOverridesWithoutDefaultsAccess

Same name in other branches
  1. 11.x core/modules/layout_builder/tests/src/Functional/LayoutBuilderOverridesTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderOverridesTest::testOverridesWithoutDefaultsAccess()

Tests Layout Builder overrides without access to edit the default layout.

File

core/modules/layout_builder/tests/src/Functional/LayoutBuilderOverridesTest.php, line 54

Class

LayoutBuilderOverridesTest
Tests the Layout Builder UI.

Namespace

Drupal\Tests\layout_builder\Functional

Code

public function testOverridesWithoutDefaultsAccess() : void {
    $assert_session = $this->assertSession();
    $page = $this->getSession()
        ->getPage();
    $this->drupalLogin($this->drupalCreateUser([
        'configure any layout',
    ]));
    LayoutBuilderEntityViewDisplay::load('node.bundle_with_section_field.default')->enableLayoutBuilder()
        ->setOverridable()
        ->save();
    $this->drupalGet('node/1');
    $page->clickLink('Layout');
    $assert_session->elementTextContains('css', '.layout-builder__message.layout-builder__message--overrides', 'You are editing the layout for this Bundle with section field content item.');
    $assert_session->linkNotExists('Edit the template for all Bundle with section field content items instead.');
}

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