function AssertPageCacheContextsAndTagsTrait::enablePageCaching

Same name and namespace in other branches
  1. 9 core/modules/system/tests/src/Functional/Cache/AssertPageCacheContextsAndTagsTrait.php \Drupal\Tests\system\Functional\Cache\AssertPageCacheContextsAndTagsTrait::enablePageCaching()
  2. 8.9.x core/modules/system/src/Tests/Cache/AssertPageCacheContextsAndTagsTrait.php \Drupal\system\Tests\Cache\AssertPageCacheContextsAndTagsTrait::enablePageCaching()
  3. 8.9.x core/modules/system/tests/src/Functional/Cache/AssertPageCacheContextsAndTagsTrait.php \Drupal\Tests\system\Functional\Cache\AssertPageCacheContextsAndTagsTrait::enablePageCaching()
  4. 10 core/modules/system/tests/src/Functional/Cache/AssertPageCacheContextsAndTagsTrait.php \Drupal\Tests\system\Functional\Cache\AssertPageCacheContextsAndTagsTrait::enablePageCaching()

Enables page caching.

13 calls to AssertPageCacheContextsAndTagsTrait::enablePageCaching()
FrontPageTest::testCacheTagsWithCachePluginNone in core/modules/node/tests/src/Functional/Views/FrontPageTest.php
Tests the cache tags when using the "none" cache plugin.
FrontPageTest::testCacheTagsWithCachePluginTag in core/modules/node/tests/src/Functional/Views/FrontPageTest.php
Tests the cache tags when using the "tag" cache plugin.
FrontPageTest::testCacheTagsWithCachePluginTime in core/modules/node/tests/src/Functional/Views/FrontPageTest.php
Tests the cache tags when using the "time" cache plugin.
PageCacheTagsIntegrationTest::setUp in core/modules/page_cache/tests/src/Functional/PageCacheTagsIntegrationTest.php
PageCacheTest::testCacheabilityOfRedirectResponses in core/modules/page_cache/tests/src/Functional/PageCacheTest.php
Tests that the Cache-Control header is added by FinishResponseSubscriber.

... See full list

File

core/modules/system/tests/src/Functional/Cache/AssertPageCacheContextsAndTagsTrait.php, line 20

Class

AssertPageCacheContextsAndTagsTrait
Provides test assertions for testing page-level cache contexts & tags.

Namespace

Drupal\Tests\system\Functional\Cache

Code

protected function enablePageCaching() {
    $config = $this->config('system.performance');
    $config->set('cache.page.max_age', 300);
    $config->save();
}

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