function LayoutBuilderViewModeTest::testFullViewModeMultipleBundles

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

Ensures that one bundle doesn't interfere with another bundle.

File

core/modules/layout_builder/tests/src/Functional/LayoutBuilderViewModeTest.php, line 256

Class

LayoutBuilderViewModeTest
Tests the Layout Builder UI with view modes.

Namespace

Drupal\Tests\layout_builder\Functional

Code

public function testFullViewModeMultipleBundles() : void {
    $assert_session = $this->assertSession();
    $page = $this->getSession()
        ->getPage();
    $this->drupalLogin($this->drupalCreateUser([
        'configure any layout',
        'administer node display',
    ]));
    // Create one bundle with the full view mode enabled.
    $this->createContentType([
        'type' => 'full_bundle',
    ]);
    $this->drupalGet('admin/structure/types/manage/full_bundle/display/default');
    $page->checkField('display_modes_custom[full]');
    $page->pressButton('Save');
    // Create another bundle without the full view mode enabled.
    $this->createContentType([
        'type' => 'default_bundle',
    ]);
    $display = LayoutBuilderEntityViewDisplay::load('node.default_bundle.default');
    $this->enableLayoutBuilder($display);
    $this->drupalGet('admin/structure/types/manage/default_bundle/display/default');
    $assert_session->checkboxChecked('layout[allow_custom]');
}

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