function PageCacheTest::testCacheableWithCustomCacheControl

Same name in other branches
  1. 9 core/modules/page_cache/tests/src/Functional/PageCacheTest.php \Drupal\Tests\page_cache\Functional\PageCacheTest::testCacheableWithCustomCacheControl()
  2. 8.9.x core/modules/page_cache/tests/src/Functional/PageCacheTest.php \Drupal\Tests\page_cache\Functional\PageCacheTest::testCacheableWithCustomCacheControl()
  3. 11.x core/modules/page_cache/tests/src/Functional/PageCacheTest.php \Drupal\Tests\page_cache\Functional\PageCacheTest::testCacheableWithCustomCacheControl()

Tests a cacheable response with custom cache control.

1 call to PageCacheTest::testCacheableWithCustomCacheControl()
PageCacheTest::testPageCache in core/modules/page_cache/tests/src/Functional/PageCacheTest.php
Tests page caching.

File

core/modules/page_cache/tests/src/Functional/PageCacheTest.php, line 571

Class

PageCacheTest
Enables the page cache and tests it with various HTTP requests.

Namespace

Drupal\Tests\page_cache\Functional

Code

protected function testCacheableWithCustomCacheControl() : void {
    $this->enablePageCaching();
    $this->drupalGet('/system-test/custom-cache-control');
    $this->assertSession()
        ->statusCodeEquals(200);
    $this->assertSession()
        ->responseHeaderEquals('Cache-Control', 'bar, private');
}

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