You are here

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

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

2 calls to AuthcacheVarnishTestCase::assertNoVary()
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 46
Test cases for authcache_varnish module.

Class

AuthcacheVarnishTestCase
Cover authcache_varnish module.

Code

protected function assertNoVary($rejectvary, $message = NULL) {
  $varyheader = $this
    ->drupalGetHeader('Vary') ?: '';
  $varyfields = array_map('trim', explode(',', $varyheader));
  $this
    ->assert(!in_array($rejectvary, $varyfields), $message ?: t('Found unexpected @field in Vary: @header.', array(
    '@field' => $rejectvary,
    '@header' => $varyheader,
  )));
}