function SectionListTestBase::testClone

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

Tests __clone().

File

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

Class

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

Namespace

Drupal\Tests\layout_builder\Kernel

Code

public function testClone() : void {
    $this->assertSame([
        'setting_1' => 'Default',
    ], $this->sectionList
        ->getSection(0)
        ->getLayoutSettings());
    $new_section_storage = clone $this->sectionList;
    $new_section_storage->getSection(0)
        ->setLayoutSettings([
        'asdf' => 'foo',
    ]);
    $this->assertSame([
        'setting_1' => 'Default',
    ], $this->sectionList
        ->getSection(0)
        ->getLayoutSettings());
}

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