function LayoutBuilderOverridesTest::testOverridesWithoutFieldUi

Same name and namespace in other branches
  1. 10 core/modules/layout_builder/tests/src/Functional/LayoutBuilderOverridesTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderOverridesTest::testOverridesWithoutFieldUi()

Tests Layout Builder overrides without Field UI installed.

File

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

Class

LayoutBuilderOverridesTest
Tests the Layout Builder UI.

Namespace

Drupal\Tests\layout_builder\Functional

Code

public function testOverridesWithoutFieldUi() : void {
    $this->container
        ->get('module_installer')
        ->uninstall([
        'field_ui',
    ]);
    $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.