You are here

protected function AuthcacheTestBackend::assertCacheControl in Authenticated User Page Caching (Authcache) 7.2

Assert that a certain directive is in the Cache-Control header.

2 calls to AuthcacheTestBackend::assertCacheControl()
AuthcacheTestBackend::testVaryHeaderWithAuthcacheConfig in tests/authcache.backend.test
Test presence of X-Authcache-Key header on HTTP response.
AuthcacheTestBackend::testVaryHeaderWithoutAuthcacheConfig in tests/authcache.backend.test
Test presence of Vary header when authcache is disabled (per config).

File

tests/authcache.backend.test, line 78
Test cases for pluggable cache backends.

Class

AuthcacheTestBackend
Cover authcache module.

Code

protected function assertCacheControl($expectcc, $message = NULL) {
  $ccheader = $this
    ->drupalGetHeader('Cache-Control') ?: '';
  $ccfields = array_map('trim', explode(',', $ccheader));
  $this
    ->assert(in_array($expectcc, $ccfields), $message ?: t('Did not find expected @field in Cache-Control: @header.', array(
    '@field' => $expectcc,
    '@header' => $ccheader,
  )));
}