You are here

public function LayoutBuilderEntityViewDisplayTest::testSetOverridable in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/tests/src/Kernel/LayoutBuilderEntityViewDisplayTest.php \Drupal\Tests\layout_builder\Kernel\LayoutBuilderEntityViewDisplayTest::testSetOverridable()

Tests that setting overridable enables Layout Builder only when set to TRUE.

File

core/modules/layout_builder/tests/src/Kernel/LayoutBuilderEntityViewDisplayTest.php, line 100

Class

LayoutBuilderEntityViewDisplayTest
@coversDefaultClass \Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay

Namespace

Drupal\Tests\layout_builder\Kernel

Code

public function testSetOverridable() {

  // Disable Layout Builder.
  $this->sectionStorage
    ->disableLayoutBuilder();

  // Set Overridable to TRUE and ensure Layout Builder is enabled.
  $this->sectionStorage
    ->setOverridable();
  $this
    ->assertEquals($this->sectionStorage
    ->isLayoutBuilderEnabled(), TRUE);

  // Ensure Layout Builder is still enabled after setting Overridable to FALSE.
  $this->sectionStorage
    ->setOverridable(FALSE);
  $this
    ->assertEquals($this->sectionStorage
    ->isLayoutBuilderEnabled(), TRUE);
}