You are here

protected function MediaTypeTest::createEntity in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/jsonapi/tests/src/Functional/MediaTypeTest.php \Drupal\Tests\jsonapi\Functional\MediaTypeTest::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/MediaTypeTest.php, line 52

Class

MediaTypeTest
JSON:API integration test for the "MediaType" config entity type.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function createEntity() {

  // Create a "Camelids" media type.
  $camelids = MediaType::create([
    'name' => 'Camelids',
    'id' => 'camelids',
    'description' => 'Camelids are large, strictly herbivorous animals with slender necks and long legs.',
    'source' => 'file',
  ]);
  $camelids
    ->save();
  return $camelids;
}