You are here

protected function LayoutBuilderSectionTest::setUp in Block Style Plugins 8.2

Overrides BrowserTestBase::setUp

File

tests/src/FunctionalJavascript/LayoutBuilderSectionTest.php, line 32

Class

LayoutBuilderSectionTest
Layout Builder section tests.

Namespace

Drupal\Tests\block_style_plugins\FunctionalJavascript

Code

protected function setUp() : void {
  parent::setUp();
  $user = $this
    ->drupalCreateUser([
    'configure any layout',
    'administer node display',
    'administer node fields',
  ]);
  $user
    ->save();
  $this
    ->drupalLogin($user);
  $this
    ->createContentType([
    'type' => 'bundle_with_section_field',
  ]);

  // The Layout Builder UI relies on local tasks.
  $this
    ->drupalPlaceBlock('local_tasks_block');

  // Enable layout builder.
  $field_ui_prefix = 'admin/structure/types/manage/bundle_with_section_field';
  $this
    ->drupalGet("{$field_ui_prefix}/display/default");
  $this
    ->submitForm([
    'layout[enabled]' => TRUE,
    'layout[allow_custom]' => TRUE,
  ], 'Save');

  // Start by creating a node.
  $node = $this
    ->createNode([
    'type' => 'bundle_with_section_field',
    'body' => [
      [
        'value' => 'The node body',
      ],
    ],
  ]);
  $node
    ->save();
}