public function AuthcacheBackendKeyManagementTestCase::testKeyRenewDuringLogout in Authenticated User Page Caching (Authcache) 7.2
Call hook_authcache_backend_key_set during logout.
File
- tests/
authcache.backend.test, line 330 - Test cases for pluggable cache backends.
Class
- AuthcacheBackendKeyManagementTestCase
- Test key management.
Code
public function testKeyRenewDuringLogout() {
$this
->drupalLogin($this->member);
$user_key = $this
->drupalGetHeader('X-Authcache-Backend-Test-Key-Exit');
$this
->assertTrue($user_key, 'User key is not empty');
$this
->assertNotEqual(authcache_backend_anonymous_key(), $user_key, 'User key is not same as the anonymous key');
variable_set('simpletest_maximum_redirects', 0);
$backend_boot = $this->stubbackend
->hook('boot', array(
'authcache_backend_test',
'Cookie',
$user_key,
));
$key_set = $this->stubbackend
->hook('authcache_backend_key_set');
$this
->drupalGet('user/logout');
$this
->assertStub($backend_boot, HookStub::once());
$this
->assertStub($key_set, HookStub::once());
$this
->assertStub($key_set, HookStub::args(array(
authcache_backend_anonymous_key(),
authcache_key_lifetime(),
FALSE,
)));
}