You are here

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

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

3 calls to AuthcacheVarnishTestCase::assertCacheControl()
AuthcacheVarnishTestCase::testGetKeyMenuCallback in modules/authcache_varnish/authcache_varnish.test
Cover authcache_varnish_get_key menu callback.
AuthcacheVarnishTestCase::testRequestValidation in modules/authcache_varnish/authcache_varnish.test
Cover authcache_varnish_request_validate().
AuthcacheVarnishTestCase::testVaryHeader in modules/authcache_varnish/authcache_varnish.test
Test presence of X-Authcache-Key header on HTTP response.

File

modules/authcache_varnish/authcache_varnish.test, line 55
Test cases for authcache_varnish module.

Class

AuthcacheVarnishTestCase
Cover authcache_varnish 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,
  )));
}