function MediaCacheTagsTest::createEntity

Creates the entity to be tested.

Return value

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

Overrides EntityCacheTagsTestBase::createEntity

File

core/modules/media/tests/src/Functional/MediaCacheTagsTest.php, line 47

Class

MediaCacheTagsTest
Tests the media items cache tags.

Namespace

Drupal\Tests\media\Functional

Code

protected function createEntity() {
  // Create a media type.
  $mediaType = $this->createMediaType('test');
  // Create a media item.
  $media = Media::create([
    'bundle' => $mediaType->id(),
    'name' => 'Unnamed',
  ]);
  $media->save();
  return $media;
}

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