function EntityViewModeResourceTestBase::createEntity

Same name in other branches
  1. 8.9.x core/tests/Drupal/FunctionalTests/Rest/EntityViewModeResourceTestBase.php \Drupal\FunctionalTests\Rest\EntityViewModeResourceTestBase::createEntity()
  2. 10 core/tests/Drupal/FunctionalTests/Rest/EntityViewModeResourceTestBase.php \Drupal\FunctionalTests\Rest\EntityViewModeResourceTestBase::createEntity()
  3. 11.x core/tests/Drupal/FunctionalTests/Rest/EntityViewModeResourceTestBase.php \Drupal\FunctionalTests\Rest\EntityViewModeResourceTestBase::createEntity()

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.