function AssertPageCacheContextsAndTagsTrait::assertCacheMaxAge
Same name in other branches
- 9 core/modules/system/tests/src/Functional/Cache/AssertPageCacheContextsAndTagsTrait.php \Drupal\Tests\system\Functional\Cache\AssertPageCacheContextsAndTagsTrait::assertCacheMaxAge()
- 8.9.x core/modules/system/src/Tests/Cache/AssertPageCacheContextsAndTagsTrait.php \Drupal\system\Tests\Cache\AssertPageCacheContextsAndTagsTrait::assertCacheMaxAge()
- 8.9.x core/modules/system/tests/src/Functional/Cache/AssertPageCacheContextsAndTagsTrait.php \Drupal\Tests\system\Functional\Cache\AssertPageCacheContextsAndTagsTrait::assertCacheMaxAge()
- 11.x core/modules/system/tests/src/Functional/Cache/AssertPageCacheContextsAndTagsTrait.php \Drupal\Tests\system\Functional\Cache\AssertPageCacheContextsAndTagsTrait::assertCacheMaxAge()
Asserts the max age header.
Parameters
int $max_age: The maximum age of the cache.
4 calls to AssertPageCacheContextsAndTagsTrait::assertCacheMaxAge()
- PageCacheTest::testCacheabilityOfRedirectResponses in core/
modules/ page_cache/ tests/ src/ Functional/ PageCacheTest.php - Tests that the Cache-Control header is added by FinishResponseSubscriber.
- PageCacheTest::testCacheableResponseResponses in core/
modules/ page_cache/ tests/ src/ Functional/ PageCacheTest.php - Tests cacheability of a CacheableResponse.
- PageCacheTest::testPageCacheHeaders in core/
modules/ page_cache/ tests/ src/ Functional/ PageCacheTest.php - Tests page cache headers.
- PageCacheTest::testPageCacheWithoutVaryCookie in core/
modules/ page_cache/ tests/ src/ Functional/ PageCacheTest.php - Tests the omit_vary_cookie setting.
File
-
core/
modules/ system/ tests/ src/ Functional/ Cache/ AssertPageCacheContextsAndTagsTrait.php, line 165
Class
- AssertPageCacheContextsAndTagsTrait
- Provides test assertions for testing page-level cache contexts & tags.
Namespace
Drupal\Tests\system\Functional\CacheCode
protected function assertCacheMaxAge(int $max_age) {
$this->assertSession()
->responseHeaderEquals('Cache-Control', "max-age={$max_age}, public");
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.