function OverridesSectionStorageTest::testIsOverridden
Same name in other branches
- 8.9.x core/modules/layout_builder/tests/src/Kernel/OverridesSectionStorageTest.php \Drupal\Tests\layout_builder\Kernel\OverridesSectionStorageTest::testIsOverridden()
- 10 core/modules/layout_builder/tests/src/Kernel/OverridesSectionStorageTest.php \Drupal\Tests\layout_builder\Kernel\OverridesSectionStorageTest::testIsOverridden()
- 11.x core/modules/layout_builder/tests/src/Kernel/OverridesSectionStorageTest.php \Drupal\Tests\layout_builder\Kernel\OverridesSectionStorageTest::testIsOverridden()
@covers ::isOverridden
File
-
core/
modules/ layout_builder/ tests/ src/ Kernel/ OverridesSectionStorageTest.php, line 261
Class
- OverridesSectionStorageTest
- @coversDefaultClass \Drupal\layout_builder\Plugin\SectionStorage\OverridesSectionStorage
Namespace
Drupal\Tests\layout_builder\KernelCode
public function testIsOverridden() {
$display = LayoutBuilderEntityViewDisplay::create([
'targetEntityType' => 'entity_test',
'bundle' => 'entity_test',
'mode' => 'default',
'status' => TRUE,
]);
$display->enableLayoutBuilder()
->setOverridable()
->save();
$entity = EntityTest::create();
$entity->set(OverridesSectionStorage::FIELD_NAME, [
new Section('layout_onecol'),
]);
$entity->save();
$entity = EntityTest::load($entity->id());
$context = EntityContext::fromEntity($entity);
$this->plugin
->setContext('entity', $context);
$this->assertTrue($this->plugin
->isOverridden());
$this->plugin
->removeSection(0);
$this->assertTrue($this->plugin
->isOverridden());
$this->plugin
->removeAllSections(TRUE);
$this->assertTrue($this->plugin
->isOverridden());
$this->plugin
->removeAllSections();
$this->assertFalse($this->plugin
->isOverridden());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.