You are here

protected function ContentLanguageSettingsResourceTestBase::createEntity in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/language/tests/src/Functional/Rest/ContentLanguageSettingsResourceTestBase.php \Drupal\Tests\language\Functional\Rest\ContentLanguageSettingsResourceTestBase::createEntity()

Creates the entity to be tested.

Return value

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

Overrides EntityResourceTestBase::createEntity

File

core/modules/language/tests/src/Functional/Rest/ContentLanguageSettingsResourceTestBase.php, line 36

Class

ContentLanguageSettingsResourceTestBase

Namespace

Drupal\Tests\language\Functional\Rest

Code

protected function createEntity() {

  // Create a "Camelids" node type.
  $camelids = NodeType::create([
    'name' => 'Camelids',
    'type' => 'camelids',
  ]);
  $camelids
    ->save();
  $entity = ContentLanguageSettings::create([
    'target_entity_type_id' => 'node',
    'target_bundle' => 'camelids',
  ]);
  $entity
    ->setDefaultLangcode('site_default')
    ->save();
  return $entity;
}