You are here

function CommentRSSUnitTest::testCommentRSS in Drupal 7

Test comments as part of an RSS feed.

File

modules/comment/comment.test, line 1781
Tests for comment.module.

Class

CommentRSSUnitTest
Unit tests for comment module integration with RSS feeds.

Code

function testCommentRSS() {

  // Find comment in RSS feed.
  $this
    ->drupalLogin($this->web_user);
  $comment = $this
    ->postComment($this->node, $this
    ->randomName(), $this
    ->randomName());
  $this
    ->drupalGet('rss.xml');
  $raw = '<comments>' . url('node/' . $this->node->nid, array(
    'fragment' => 'comments',
    'absolute' => TRUE,
  )) . '</comments>';
  $this
    ->assertRaw($raw, 'Comments as part of RSS feed.');

  // Hide comments from RSS feed and check presence.
  $this->node->comment = COMMENT_NODE_HIDDEN;
  node_save($this->node);
  $this
    ->drupalGet('rss.xml');
  $this
    ->assertNoRaw($raw, 'Hidden comments is not a part of RSS feed.');
}