function LayoutBuilderPrepareLayoutTest::setUp

Same name in other branches
  1. 9 core/modules/layout_builder/tests/src/Functional/LayoutBuilderPrepareLayoutTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderPrepareLayoutTest::setUp()
  2. 11.x core/modules/layout_builder/tests/src/Functional/LayoutBuilderPrepareLayoutTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderPrepareLayoutTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/layout_builder/tests/src/Functional/LayoutBuilderPrepareLayoutTest.php, line 35

Class

LayoutBuilderPrepareLayoutTest
Tests the ability to alter a layout builder element while preparing.

Namespace

Drupal\Tests\layout_builder\Functional

Code

protected function setUp() : void {
    parent::setUp();
    $this->createContentType([
        'type' => 'bundle_with_section_field',
    ]);
    LayoutBuilderEntityViewDisplay::load('node.bundle_with_section_field.default')->enableLayoutBuilder()
        ->setOverridable()
        ->save();
    $this->createNode([
        'type' => 'bundle_with_section_field',
        'title' => 'The first node title',
        'body' => [
            [
                'value' => 'The first node body',
            ],
        ],
    ]);
    $this->createNode([
        'type' => 'bundle_with_section_field',
        'title' => 'The second node title',
        'body' => [
            [
                'value' => 'The second node body',
            ],
        ],
    ]);
    $this->createNode([
        'type' => 'bundle_with_section_field',
        'title' => 'The third node title',
        'body' => [
            [
                'value' => 'The third node body',
            ],
        ],
    ]);
}

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