protected function MediaCacheTagsTest::createEntity in Drupal 9
Same name and namespace in other branches
- 8 core/modules/media/tests/src/Functional/MediaCacheTagsTest.php \Drupal\Tests\media\Functional\MediaCacheTagsTest::createEntity()
- 10 core/modules/media/tests/src/Functional/MediaCacheTagsTest.php \Drupal\Tests\media\Functional\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\FunctionalCode
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;
}