function ImageFormatterTest::assertCacheTags

Same name and namespace in other branches
  1. 8.9.x core/modules/image/tests/src/Kernel/ImageFormatterTest.php \Drupal\Tests\image\Kernel\ImageFormatterTest::assertCacheTags()
  2. 10 core/modules/image/tests/src/Kernel/ImageFormatterTest.php \Drupal\Tests\image\Kernel\ImageFormatterTest::assertCacheTags()
  3. 11.x core/modules/image/tests/src/Kernel/ImageFormatterTest.php \Drupal\Tests\image\Kernel\ImageFormatterTest::assertCacheTags()

Asserts that a renderable array has a set of cache tags.

@internal

Parameters

array $renderable: The renderable array. Must have a #cache[tags] element.

array $cache_tags: The expected cache tags.

1 call to ImageFormatterTest::assertCacheTags()
ImageFormatterTest::testImageFormatterSvg in core/modules/image/tests/src/Kernel/ImageFormatterTest.php
Tests ImageFormatter's handling of SVG images.

File

core/modules/image/tests/src/Kernel/ImageFormatterTest.php, line 212

Class

ImageFormatterTest
Tests the image field rendering using entity fields of the image field type.

Namespace

Drupal\Tests\image\Kernel

Code

protected function assertCacheTags(array $renderable, array $cache_tags) : void {
    $diff = array_diff($cache_tags, $renderable['#cache']['tags']);
    $this->assertEmpty($diff);
}

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