function WebTestBase::assertCacheTag

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.");
}

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