You are here

protected function EntityTestMapFieldTest::createEntity in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/jsonapi/tests/src/Functional/EntityTestMapFieldTest.php \Drupal\Tests\jsonapi\Functional\EntityTestMapFieldTest::createEntity()
  2. 10 core/modules/jsonapi/tests/src/Functional/EntityTestMapFieldTest.php \Drupal\Tests\jsonapi\Functional\EntityTestMapFieldTest::createEntity()

Creates the entity to be tested.

Return value

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

Overrides ResourceTestBase::createEntity

File

core/modules/jsonapi/tests/src/Functional/EntityTestMapFieldTest.php, line 74

Class

EntityTestMapFieldTest
JSON:API integration test for the "EntityTestMapField" content entity type.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function createEntity() {
  $entity = EntityTestMapField::create([
    'name' => 'Llama',
    'type' => 'entity_test_map_field',
    'data' => [
      static::$mapValue,
    ],
  ]);
  $entity
    ->setOwnerId(0);
  $entity
    ->save();
  return $entity;
}