You are here

protected function WebTestBase::assertCacheTag in Drupal 8

Asserts whether an expected cache tag was present in the last response.

Parameters

string $expected_cache_tag: The expected cache tag.

File

core/modules/simpletest/src/WebTestBase.php, line 2054

Class

WebTestBase
Test case for typical Drupal tests.

Namespace

Drupal\simpletest

Code

protected function assertCacheTag($expected_cache_tag) {
  $cache_tags = explode(' ', $this
    ->drupalGetHeader('X-Drupal-Cache-Tags'));
  $this
    ->assertTrue(in_array($expected_cache_tag, $cache_tags), "'" . $expected_cache_tag . "' is present in the X-Drupal-Cache-Tags header.");
}