public function AuthcacheFieldTest::testNodeMarkupSubstitution in Authenticated User Page Caching (Authcache) 7.2
Test that the field markup is substituted by a partial.
Covers authcache_field_attach_view_alter()
File
- modules/
authcache_field/ authcache_field.test, line 103 - Test cases for the Authcache Field module.
Class
- AuthcacheFieldTest
- Tests for markup substitution.
Code
public function testNodeMarkupSubstitution() {
$this->stubmod
->hook('authcache_p13n_client', array(
'authcache_p13n_test' => array(
'title' => t('Test Client'),
'enabled' => TRUE,
),
));
$this
->drupalLogin($this->member);
// M1: Visit the front page populated with two node having one field each.
$assembly_markup = $this
->randomName(8);
$assembly_stub = HookStub::on('theme_authcache_p13n_assembly__authcache_p13n_test', $assembly_markup);
$partial_markup = $this
->randomName(8);
$partial_stub = HookStub::on('theme_authcache_p13n_partial__authcache_p13n_test', $partial_markup);
$this
->drupalGet('node');
$this
->assertStub($assembly_stub, HookStub::times(1));
$this
->assertStub($partial_stub, HookStub::times(2));
// M1: Visit a full node view.
$assembly_markup = $this
->randomName(8);
$assembly_stub = HookStub::on('theme_authcache_p13n_assembly__authcache_p13n_test', $assembly_markup);
$partial_markup = $this
->randomName(8);
$partial_stub = HookStub::on('theme_authcache_p13n_partial__authcache_p13n_test', $partial_markup);
$this
->drupalGet('node/' . $this->node1->nid);
$this
->assertStub($assembly_stub, HookStub::times(1));
$this
->assertStub($partial_stub, HookStub::times(1));
}