function LayoutBuilderTest::testFullViewModeMultipleBundles

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

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

File

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

Class

LayoutBuilderTest
Tests the Layout Builder UI.

Namespace

Drupal\Tests\layout_builder\Functional

Code

public function testFullViewModeMultipleBundles() {
    $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',
    ]);
    $this->drupalGet('admin/structure/types/manage/default_bundle/display/default');
    // Enable Layout Builder for defaults and overrides.
    $page->checkField('layout[enabled]');
    $page->pressButton('Save');
    $page->checkField('layout[allow_custom]');
    $page->pressButton('Save');
    $assert_session->checkboxChecked('layout[allow_custom]');
}

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