public function AuthcacheBuiltinTestCacheBackend::testDisableWhenCorePageCachingActive in Authenticated User Page Caching (Authcache) 7.2
Ensure that backend is disabled when core page cache is active.
File
- modules/
authcache_builtin/ tests/ authcache_builtin.cache-backend.test, line 287 - Test cases for the Authcache Bultin Cache Backend module.
Class
- AuthcacheBuiltinTestCacheBackend
- Tests update functionality unrelated to the database.
Code
public function testDisableWhenCorePageCachingActive() {
$account = $this
->drupalCreateUser();
variable_set('authcache_roles', array(
DRUPAL_AUTHENTICATED_RID => DRUPAL_AUTHENTICATED_RID,
));
// Login and warm up cache.
$this
->drupalLogin($account);
$this
->drupalGet($this->fcURL . '?q=node', array(), $this
->buildRequestHeaders(0x1));
$this
->assertResponse(200);
$this
->assertEqual('MISS', $this
->drupalGetHeader('X-Drupal-Cache'), t('Cache miss on first request with authenticated user'));
$this
->drupalGet($this->fcURL . '?q=node', array(), $this
->buildRequestHeaders(0x1));
$this
->assertResponse(200);
$this
->assertEqual('HIT', $this
->drupalGetHeader('X-Drupal-Cache'), t('Cache hit on first request with authenticated user'));
// Turn on page caching.
variable_set('cache', TRUE);
$this
->drupalGet($this->fcURL . '?q=node', array(), $this
->buildRequestHeaders(0x1));
$this
->assertResponse(200);
$this
->assertFalse($this
->drupalGetHeader('X-Drupal-Cache'), t('Do not attempt to serve page from cache when core page cache is active'));
// Turn off page caching.
variable_del('cache');
// Retry.
$this
->drupalGet($this->fcURL . '?q=node', array(), $this
->buildRequestHeaders(0x1));
$this
->assertResponse(200);
$this
->assertEqual('HIT', $this
->drupalGetHeader('X-Drupal-Cache'), t('Cache hit on first request with authenticated user after core cache is disabled again'));
}