You are here

protected function MediaTypeTest::createEntity in JSON:API 8.2

Same name and namespace in other branches
  1. 8 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

tests/src/Functional/MediaTypeTest.php, line 47

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