function MediaCacheTagsTest::getAdditionalCacheTagsForEntity

Returns the additional (non-standard) cache tags for the tested entity.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity to be tested, as created by createEntity().

Return value

array An array of the additional cache tags.

Overrides EntityCacheTagsTestBase::getAdditionalCacheTagsForEntity

File

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

Class

MediaCacheTagsTest
Tests the media items cache tags.

Namespace

Drupal\Tests\media\Functional

Code

protected function getAdditionalCacheTagsForEntity(EntityInterface $media) : array {
  // Each media item must have an author and a thumbnail.
  return [
    'user:' . $media->getOwnerId(),
    'config:image.style.thumbnail',
    'file:' . $media->get('thumbnail')->entity
      ->id(),
  ];
}

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