function PageCacheTagsTestBase::verifyDynamicPageCache

Same name in other branches
  1. 8.9.x core/modules/system/tests/src/Functional/Cache/PageCacheTagsTestBase.php \Drupal\Tests\system\Functional\Cache\PageCacheTagsTestBase::verifyDynamicPageCache()
  2. 10 core/modules/system/tests/src/Functional/Cache/PageCacheTagsTestBase.php \Drupal\Tests\system\Functional\Cache\PageCacheTagsTestBase::verifyDynamicPageCache()
  3. 11.x core/modules/system/tests/src/Functional/Cache/PageCacheTagsTestBase.php \Drupal\Tests\system\Functional\Cache\PageCacheTagsTestBase::verifyDynamicPageCache()

Verify that when loading a given page, it's a page cache hit or miss.

Parameters

\Drupal\Core\Url $url: The page for this URL will be loaded.

string $hit_or_miss: 'HIT' if a page cache hit is expected, 'MISS' otherwise.

1 call to PageCacheTagsTestBase::verifyDynamicPageCache()
ShortcutCacheTagsTest::testToolbar in core/modules/shortcut/tests/src/Functional/ShortcutCacheTagsTest.php
Tests visibility and cacheability of shortcuts in the toolbar.

File

core/modules/system/tests/src/Functional/Cache/PageCacheTagsTestBase.php, line 60

Class

PageCacheTagsTestBase
Provides helper methods for page cache tags tests.

Namespace

Drupal\Tests\system\Functional\Cache

Code

protected function verifyDynamicPageCache(Url $url, $hit_or_miss) {
    $this->drupalGet($url);
    $this->assertSession()
        ->responseHeaderEquals('X-Drupal-Dynamic-Cache', $hit_or_miss);
}

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