public function AuthcacheP13nTestClient::testGetPreferredClientDefaultClientList in Authenticated User Page Caching (Authcache) 7.2
Cover authcache_p13n_client_get_preferred().
Also cover hook_authcache_p13n_client_order() with default client_info.
File
- modules/
authcache_p13n/ tests/ authcache_p13n.client.test, line 85 - Defines tests for markup replacement clients.
Class
- AuthcacheP13nTestClient
- Tests update functionality unrelated to the database.
Code
public function testGetPreferredClientDefaultClientList() {
$client_info = array(
'enabled_client' => array(
'title' => 'This client is enabled',
'enabled' => TRUE,
'weight' => 10,
),
'disabled_client' => array(
'title' => 'That one is disabled',
'enabled' => FALSE,
'weight' => 5,
),
'also_enabled_client' => array(
'title' => 'Also enabled',
'enabled' => TRUE,
'weight' => 0,
),
'invalid_client' => array(
'title' => 'Enable flag missing',
'weight' => -5,
),
);
$alter_info = array(
'enabled_client' => $client_info['enabled_client'],
'also_enabled_client' => $client_info['also_enabled_client'],
);
$client_info_stub = $this->stubmod
->hook('authcache_p13n_client', $client_info);
$client_order_alter_stub = $this->stubmod
->hook('authcache_p13n_client_order_alter');
$result = authcache_p13n_client_get_preferred('fragment', 'some');
$this
->assertEqual('also_enabled_client', $result);
$this
->assertStub($client_info_stub, HookStub::once());
$expect_args = array(
$alter_info,
'fragment',
'some',
NULL,
);
$this
->assertStub($client_order_alter_stub, HookStub::args($expect_args));
}