You are here

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

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

2 calls to AuthcacheTestBackend::assertVary()
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 60
Test cases for pluggable cache backends.

Class

AuthcacheTestBackend
Cover authcache 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('Vary header @header contains @field.', array(
    '@field' => $expectvary,
    '@header' => $varyheader,
  )));
}