You are here

public function AuthcacheAuthenticatedKeysTestCase::testDifferentKeysForDifferentRoles in Authenticated User Page Caching (Authcache) 7.2

Test different keys for different roles.

Ensure that users with the different role combination also have the. different authcache key.

File

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

Class

AuthcacheAuthenticatedKeysTestCase
Test key computation and handling.

Code

public function testDifferentKeysForDifferentRoles() {
  $this
    ->setupConfig();
  $this
    ->resetTestVariables();
  $collected_keys = array();
  $this
    ->drupalLogout();
  $collected_keys[] = $this
    ->drupalGet('authcache-test-get-key');
  $accounts = array(
    $this->plainUser,
    $this->webUser,
    $this->adminUser,
    $this->superUser,
  );
  foreach ($accounts as $account) {
    $this
      ->drupalLogin($account);
    $collected_keys[] = $this
      ->drupalGet('authcache-test-get-key');
    $this
      ->drupalLogout();
  }
  sort($collected_keys);
  $this
    ->assertEqual($collected_keys, array_unique($collected_keys));
}