function SectionListTestBase::testInsertSection

Same name in other branches
  1. 10 core/modules/layout_builder/tests/src/Kernel/SectionListTestBase.php \Drupal\Tests\layout_builder\Kernel\SectionListTestBase::testInsertSection()
  2. 11.x core/modules/layout_builder/tests/src/Kernel/SectionListTestBase.php \Drupal\Tests\layout_builder\Kernel\SectionListTestBase::testInsertSection()

@covers ::insertSection

File

core/modules/layout_builder/tests/src/Kernel/SectionListTestBase.php, line 92

Class

SectionListTestBase
Provides a base class for testing implementations of a section list.

Namespace

Drupal\Tests\layout_builder\Kernel

Code

public function testInsertSection() {
    $expected = [
        new Section('layout_test_plugin', [
            'setting_1' => 'Default',
        ], [
            'first-uuid' => new SectionComponent('first-uuid', 'content', [
                'id' => 'foo',
            ]),
        ]),
        new Section('layout_onecol'),
        new Section('layout_test_plugin', [
            'setting_1' => 'bar',
        ], [
            'second-uuid' => new SectionComponent('second-uuid', 'content', [
                'id' => 'foo',
            ]),
        ]),
    ];
    $this->sectionList
        ->insertSection(1, new Section('layout_onecol'));
    $this->assertSections($expected);
}

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