You are here

public function LayoutBuilderTest::testFullViewModeMultipleBundles in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderTest::testFullViewModeMultipleBundles()
  2. 10 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 823

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]');
}