public function AuthcacheEnumKeysTestCase::testCustomAnonymousKeys in Authenticated User Page Caching (Authcache) 7.2
Test anonymous key customization.
File
- modules/
authcache_enum/ lib/ Drupal/ authcache_enum/ Tests/ AuthcacheEnumKeysTestCase.php, line 106 - Defines a test case covering _authcache_enum_cartesian.
Class
- AuthcacheEnumKeysTestCase
- Unit tests for _authcache_enum_comb.
Namespace
Drupal\authcache_enum\TestsCode
public function testCustomAnonymousKeys() {
global $base_root;
$keys = array(
$this
->randomName(6),
$this
->randomName(7),
$this
->randomName(8),
);
$delete_key = $keys[1];
$insert_key = $this
->randomName(9);
$alter_keys = array(
'delete' => array(
$base_root,
$delete_key,
),
'insert' => array(
$insert_key,
),
);
$expected_keys = array(
$keys[0],
$keys[2],
$insert_key,
);
$keystub = $this->stubmod
->hook('authcache_enum_anonymous_keys', $keys);
$alterstub = $this->stubmod
->hook('authcache_enum_anonymous_keys_alter', $alter_keys);
$result = authcache_enum_keys();
$this
->assertStub($keystub, \HookStub::once());
$this
->assertStub($alterstub, \HookStub::once());
$this
->assertEqual($expected_keys, $result);
}