You are here

public function AuthcacheAnonymousKeysTestCase::testDefaultAnonymousKey in Authenticated User Page Caching (Authcache) 7.2

Test default anonymous key.

Verify that the default key for anonymous users is never returned for authenticated users.

File

./authcache.test, line 1388
Tests for system.module.

Class

AuthcacheAnonymousKeysTestCase
Test key computation and handling

Code

public function testDefaultAnonymousKey() {
  global $base_root;
  $this
    ->setupConfig();
  $this
    ->resetTestVariables();
  $this
    ->drupalLogout();
  $anon_key = $this
    ->drupalGet('authcache-test-get-key');
  $this
    ->assertEqual($base_root, $anon_key);
  $this
    ->drupalLogin($this->plainUser);
  $plain_user_key = $this
    ->drupalGet('authcache-test-get-key');
  $this
    ->assertNotEqual($base_root, $plain_user_key);
  $this
    ->drupalLogout();
  $this
    ->drupalLogin($this->webUser);
  $web_user_key = $this
    ->drupalGet('authcache-test-get-key');
  $this
    ->assertNotEqual($base_root, $web_user_key);
  $this
    ->drupalLogout();
  $this
    ->drupalLogin($this->adminUser);
  $admin_user_key = $this
    ->drupalGet('authcache-test-get-key');
  $this
    ->assertNotEqual($base_root, $admin_user_key);
  $this
    ->drupalLogout();
  $this
    ->drupalLogin($this->superUser);
  $super_user_key = $this
    ->drupalGet('authcache-test-get-key');
  $this
    ->assertNotEqual($base_root, $super_user_key);
  $this
    ->drupalLogout();
}