function EntityTestMapFieldTest::createEntity

Same name in other branches
  1. 9 core/modules/jsonapi/tests/src/Functional/EntityTestMapFieldTest.php \Drupal\Tests\jsonapi\Functional\EntityTestMapFieldTest::createEntity()
  2. 8.9.x core/modules/jsonapi/tests/src/Functional/EntityTestMapFieldTest.php \Drupal\Tests\jsonapi\Functional\EntityTestMapFieldTest::createEntity()
  3. 11.x core/modules/jsonapi/tests/src/Functional/EntityTestMapFieldTest.php \Drupal\Tests\jsonapi\Functional\EntityTestMapFieldTest::createEntity()

Overrides ResourceTestBase::createEntity

File

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

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

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