public function AuthcacheCommentTest::testUserSettingInCommentForm in Authenticated User Page Caching (Authcache) 7.2
Ensure that user setting is embedded for authenticated users.
File
- modules/
authcache_comment/ authcache_comment.test, line 166 - Test cases for the Authcache Comment module.
Class
- AuthcacheCommentTest
- Tests for markup substitution.
Code
public function testUserSettingInCommentForm() {
$this->stubmod
->hook('authcache_p13n_client', array(
'authcache_p13n_test' => array(
'title' => t('Test Client'),
'enabled' => TRUE,
),
));
$setting_markup = $this
->randomName(8);
$setting_stub = HookStub::on('theme_authcache_p13n_setting__authcache_p13n_test', $setting_markup);
// Then ensure that the setting is added when the site wide contact form is
// accessed with authenticated user.
$this
->drupalLogin($this->member1);
$this
->drupalGet('comment/reply/' . $this->node->nid);
$this
->assertNoText($this->member1->name, 'Should remove the users name from the comment form');
$this
->assertText($setting_markup);
$this
->assertStub($setting_stub, HookStub::once());
$this
->assertIdentical(1, count($this
->xpath('//span[@class=:class and @data-p13n-user-prop=:prop]', array(
':class' => 'authcache-user',
':prop' => 'name',
))), 'Generate placeholder markup for user property');
}