You are here

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

Test same keys for same roles.

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

File

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

Class

AuthcacheAuthenticatedKeysTestCase
Test key computation and handling.

Code

public function testSameKeysForSameRoles() {
  $this
    ->setupConfig();
  foreach (array(
    $this->plainUser,
    $this->webUser,
    $this->adminUser,
  ) as $account) {
    $this
      ->drupalLogin($account);
    $account_key = $this
      ->drupalGet('authcache-test-get-key');
    $this
      ->drupalLogout();
    $new_account = $this
      ->drupalCreateUser();
    user_save($new_account, array(
      'roles' => $account->roles,
    ));
    $this
      ->drupalLogin($new_account);
    $new_account_key = $this
      ->drupalGet('authcache-test-get-key');
    $this
      ->drupalLogout();
    $this
      ->assertEqual($account_key, $new_account_key);
  }
}