You are here

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

Test removal of the new marker.

Cover authcache_comment_preprocess_comment()

File

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

Class

AuthcacheCommentTest
Tests for markup substitution.

Code

public function testNewMarkerRemoval() {
  $this->stubmod
    ->hook('authcache_p13n_client', array(
    'authcache_p13n_test' => array(
      'title' => t('Test Client'),
      'enabled' => TRUE,
    ),
  ));

  // Simulate member1 visiting the node a minute ago.
  db_merge('history')
    ->key(array(
    'uid' => $this->member1->uid,
    'nid' => $this->node->nid,
  ))
    ->fields(array(
    'timestamp' => time() - 60,
  ))
    ->execute();

  // Login with member2 and post a comment.
  $this
    ->drupalLogin($this->member2);
  $comment = $this
    ->postComment($this->node, $this
    ->randomName(8));

  // Ensure that the new-marker is not in the markup.
  $this
    ->drupalLogin($this->member1);
  $this
    ->drupalGet('node/' . $this->node->nid);
  $this
    ->assertFalse($this
    ->xpath('//span[contains(@class, :class)]', array(
    ':class' => 'new',
  )), 'No new-marker on the page');
}