You are here

protected function LayoutBuilderModalTest::setUp in Layout Builder Modal 8

Overrides BrowserTestBase::setUp

File

tests/src/FunctionalJavascript/LayoutBuilderModalTest.php, line 39

Class

LayoutBuilderModalTest
Tests Layout Builder Modal.

Namespace

Drupal\Tests\layout_builder_modal\FunctionalJavascript

Code

protected function setUp() {
  parent::setUp();
  $this
    ->drupalPlaceBlock('local_tasks_block');
  $bundle = BlockContentType::create([
    'id' => 'basic',
    'label' => 'Basic',
  ]);
  $bundle
    ->save();
  block_content_add_body_field($bundle
    ->id());
  $this
    ->createContentType([
    'type' => 'bundle_with_section_field',
  ]);
  $this
    ->createNode([
    'type' => 'bundle_with_section_field',
    'title' => 'The node title',
    'body' => [
      [
        'value' => 'The node body',
      ],
    ],
  ]);
  $this
    ->drupalLogin($this
    ->drupalCreateUser([
    'access contextual links',
    'configure any layout',
    'administer node display',
    'create and edit custom blocks',
  ], 'foobar'));

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