public function AuthcacheP13nTestSession::testInvalidateOnLoginAndLogout in Authenticated User Page Caching (Authcache) 7.2
Ensure that the browser session is invalidated upon login/logout.
File
- modules/
authcache_p13n/ tests/ authcache_p13n.session.test, line 74 - Define test for browser cache invalidation.
Class
- AuthcacheP13nTestSession
- Tests browser cache invalidation.
Code
public function testInvalidateOnLoginAndLogout() {
$user = $this
->drupalCreateUser(array(
'access content',
));
// Test login.
$stub = $this->stubmod
->hook('authcache_p13n_session_invalidate');
$this
->drupalLogin($user);
$this
->assertStub($stub, HookStub::once());
// Ensure that cookie was created.
$this
->assertNotNull($this->session_id);
$this
->assertNotNull($this->cookies['aucp13n']['value']);
$this
->assertNotEqual('deleted', $this->cookies['aucp13n']['value']);
// Test logout.
$stub = $this->stubmod
->hook('authcache_p13n_session_invalidate');
$this
->drupalLogout($user);
$this
->assertStub($stub, HookStub::once());
// Ensure that cookie was deleted.
$this
->assertNull($this->session_id);
$this
->assertEqual('deleted', $this->cookies['aucp13n']['value']);
}