Tests for comment counters on the tracker listing.
function testTrackerNewComments() {
$this
->drupalLogin($this->user);
$node = $this
->drupalCreateNode(array(
'comment' => 2,
'title' => $this
->randomName(8),
));
// Add a comment to the page.
$comment = array(
'subject' => $this
->randomName(),
'comment_body[' . Language::LANGCODE_NOT_SPECIFIED . '][0][value]' => $this
->randomName(20),
);
// The new comment is automatically viewed by the current user.
$this
->drupalPost('comment/reply/' . $node->nid, $comment, t('Save'));
$this
->drupalLogin($this->other_user);
$this
->drupalGet('tracker');
$this
->assertText('1 new', 'New comments are counted on the tracker listing pages.');
$this
->drupalGet('node/' . $node->nid);
// Add another comment as other_user.
$comment = array(
'subject' => $this
->randomName(),
'comment_body[' . Language::LANGCODE_NOT_SPECIFIED . '][0][value]' => $this
->randomName(20),
);
// If the comment is posted in the same second as the last one then Drupal
// can't tell the difference, so we wait one second here.
sleep(1);
$this
->drupalPost('comment/reply/' . $node->nid, $comment, t('Save'));
$this
->drupalLogin($this->user);
$this
->drupalGet('tracker');
$this
->assertText('1 new', 'New comments are counted on the tracker listing pages.');
}