You are here

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

Assert that a certain vary-field is in the Vary header.

3 calls to AuthcacheVarnishTestCase::assertVary()
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 37
Test cases for authcache_varnish module.

Class

AuthcacheVarnishTestCase
Cover authcache_varnish module.

Code

protected function assertVary($expectvary, $message = NULL) {
  $varyheader = $this
    ->drupalGetHeader('Vary') ?: '';
  $varyfields = array_map('trim', explode(',', $varyheader));
  $this
    ->assert(in_array($expectvary, $varyfields), $message ?: t('Did not find expected @field in Vary: @header.', array(
    '@field' => $expectvary,
    '@header' => $varyheader,
  )));
}