You are here

protected function EntityViewDisplayResourceTestBase::createEntity in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayResourceTestBase.php \Drupal\FunctionalTests\Rest\EntityViewDisplayResourceTestBase::createEntity()
  2. 10 core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayResourceTestBase.php \Drupal\FunctionalTests\Rest\EntityViewDisplayResourceTestBase::createEntity()

Creates the entity to be tested.

Return value

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

Overrides EntityResourceTestBase::createEntity

1 call to EntityViewDisplayResourceTestBase::createEntity()
LayoutBuilderEntityViewDisplayResourceTestBase::createEntity in core/modules/layout_builder/tests/src/Functional/Rest/LayoutBuilderEntityViewDisplayResourceTestBase.php
Creates the entity to be tested.
1 method overrides EntityViewDisplayResourceTestBase::createEntity()
LayoutBuilderEntityViewDisplayResourceTestBase::createEntity in core/modules/layout_builder/tests/src/Functional/Rest/LayoutBuilderEntityViewDisplayResourceTestBase.php
Creates the entity to be tested.

File

core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayResourceTestBase.php, line 41

Class

EntityViewDisplayResourceTestBase

Namespace

Drupal\FunctionalTests\Rest

Code

protected function createEntity() {

  // Create a "Camelids" node type.
  $camelids = NodeType::create([
    'name' => 'Camelids',
    'type' => 'camelids',
  ]);
  $camelids
    ->save();

  // Create a view display.
  $view_display = EntityViewDisplay::create([
    'targetEntityType' => 'node',
    'bundle' => 'camelids',
    'mode' => 'default',
    'status' => TRUE,
  ]);
  $view_display
    ->save();
  return $view_display;
}