You are here

public function LayoutBuilderTest::testOverridesWithoutDefaultsAccess in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderTest::testOverridesWithoutDefaultsAccess()

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

File

core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php, line 106

Class

LayoutBuilderTest
Tests the Layout Builder UI.

Namespace

Drupal\Tests\layout_builder\Functional

Code

public function testOverridesWithoutDefaultsAccess() {
  $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.');
}