You are here

protected function EntityViewDisplayResourceTestBase::createEntity in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayResourceTestBase.php \Drupal\FunctionalTests\Rest\EntityViewDisplayResourceTestBase::createEntity()
  2. 9 core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayResourceTestBase.php \Drupal\FunctionalTests\Rest\EntityViewDisplayResourceTestBase::createEntity()
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;
}