You are here

protected function LayoutBuilderEntityViewDisplayResourceTestBase::createEntity in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/tests/src/Functional/Rest/LayoutBuilderEntityViewDisplayResourceTestBase.php \Drupal\Tests\layout_builder\Functional\Rest\LayoutBuilderEntityViewDisplayResourceTestBase::createEntity()
  2. 10 core/modules/layout_builder/tests/src/Functional/Rest/LayoutBuilderEntityViewDisplayResourceTestBase.php \Drupal\Tests\layout_builder\Functional\Rest\LayoutBuilderEntityViewDisplayResourceTestBase::createEntity()

Creates the entity to be tested.

Return value

\Drupal\Core\Entity\EntityInterface The entity to be tested.

Overrides EntityViewDisplayResourceTestBase::createEntity

File

core/modules/layout_builder/tests/src/Functional/Rest/LayoutBuilderEntityViewDisplayResourceTestBase.php, line 21

Class

LayoutBuilderEntityViewDisplayResourceTestBase
Provides a base class for testing LayoutBuilderEntityViewDisplay resources.

Namespace

Drupal\Tests\layout_builder\Functional\Rest

Code

protected function createEntity() {

  /** @var \Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay $entity */
  $entity = parent::createEntity();
  $entity
    ->enableLayoutBuilder()
    ->setOverridable()
    ->save();
  $this
    ->assertCount(1, $entity
    ->getThirdPartySetting('layout_builder', 'sections'));
  return $entity;
}