You are here

protected function EntityViewModeResourceTestBase::createEntity in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/FunctionalTests/Rest/EntityViewModeResourceTestBase.php \Drupal\FunctionalTests\Rest\EntityViewModeResourceTestBase::createEntity()

Creates the entity to be tested.

Return value

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

Overrides EntityResourceTestBase::createEntity

File

core/tests/Drupal/FunctionalTests/Rest/EntityViewModeResourceTestBase.php, line 37

Class

EntityViewModeResourceTestBase

Namespace

Drupal\FunctionalTests\Rest

Code

protected function createEntity() {
  $entity_view_mode = EntityViewMode::create([
    'id' => 'user.test',
    'label' => 'Test',
    'targetEntityType' => 'user',
  ]);
  $entity_view_mode
    ->save();
  return $entity_view_mode;
}