public function AuthcacheP13nTestSession::testInvalidateWhenSessionOpen in Authenticated User Page Caching (Authcache) 7.2
Ensure that a cookie is set as soon as there is some data in the session.
File
- modules/
authcache_p13n/ tests/ authcache_p13n.session.test, line 98 - Define test for browser cache invalidation.
Class
- AuthcacheP13nTestSession
- Tests browser cache invalidation.
Code
public function testInvalidateWhenSessionOpen() {
// Test open anonymous session.
$stub = $this->stubmod
->hook('set_session_data', 'some-session-data');
$this
->drupalGet('authcache-p13n-test-session');
$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 close anonymous session.
$stub = $this->stubmod
->hook('set_session_data', NULL);
$this
->drupalGet('authcache-p13n-test-session');
$this
->assertStub($stub, HookStub::once());
// Ensure that cookie was deleted.
$this
->assertNull($this->session_id);
$this
->assertEqual('deleted', $this->cookies['aucp13n']['value']);
}