You are here

protected function LayoutBuilderAccessTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/tests/src/Functional/LayoutBuilderAccessTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderAccessTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/layout_builder/tests/src/Functional/LayoutBuilderAccessTest.php, line 33

Class

LayoutBuilderAccessTest
Tests access to Layout Builder.

Namespace

Drupal\Tests\layout_builder\Functional

Code

protected function setUp() : void {
  parent::setUp();

  // Enable Layout Builder for one content type.
  $this
    ->createContentType([
    'type' => 'bundle_with_section_field',
  ]);
  LayoutBuilderEntityViewDisplay::load('node.bundle_with_section_field.default')
    ->enableLayoutBuilder()
    ->setOverridable()
    ->save();

  // Enable Layout Builder for user profiles.
  $values = [
    'targetEntityType' => 'user',
    'bundle' => 'user',
    'mode' => 'default',
    'status' => TRUE,
  ];
  LayoutBuilderEntityViewDisplay::create($values)
    ->enableLayoutBuilder()
    ->setOverridable()
    ->save();
}