You are here

public function AuthcacheCommentTest::testNoMarkupSubstitutionForGuestUser in Authenticated User Page Caching (Authcache) 7.2

Ensure that markup is substituted for authcache enabled comments.

File

modules/authcache_comment/authcache_comment.test, line 416
Test cases for the Authcache Comment module.

Class

AuthcacheCommentTest
Tests for markup substitution.

Code

public function testNoMarkupSubstitutionForGuestUser() {

  // Post a comment.
  $this
    ->drupalLogin($this->member1);
  $comment = $this
    ->postComment($this->node, $this
    ->randomName(8));
  $this
    ->drupalLogout();

  // Setup authcache markup substitution mocking.
  $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);

  // Ensure that no markup substitution takes place for anonymous users on
  // front page.
  $this
    ->drupalGet('node');
  $this
    ->assertStub($setting_stub, HookStub::never());

  // Ensure that no markup substitution takes place for anonymous users on
  // node page.
  $this
    ->drupalGet('node/' . $this->node->nid);
  $this
    ->assertStub($setting_stub, HookStub::never());
}