function LayoutBuilderTest::testOverridesWithoutFieldUi

Tests Layout Builder overrides without Field UI installed.

File

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

Class

LayoutBuilderTest
Tests the Layout Builder UI.

Namespace

Drupal\Tests\layout_builder\Functional

Code

public function testOverridesWithoutFieldUi() {
    $this->container
        ->get('module_installer')
        ->uninstall([
        'field_ui',
    ]);
    $assert_session = $this->assertSession();
    $page = $this->getSession()
        ->getPage();
    // @todo In https://www.drupal.org/node/540008 switch this to logging in as
    //   a user with the 'configure any layout' permission.
    $this->drupalLogin($this->rootUser);
    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.