diff options
Diffstat (limited to 'modules/comment')
-rw-r--r-- | modules/comment/comment.test | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/modules/comment/comment.test b/modules/comment/comment.test index b04618724..66933615e 100644 --- a/modules/comment/comment.test +++ b/modules/comment/comment.test @@ -1199,6 +1199,30 @@ class CommentRdfaTestCase extends CommentHelperCase { } /** + * Test RDF comment replies. + */ + function testCommentReplyOfRdfaMarkup() { + // Posts comment #1 as a registered user. + $this->drupalLogin($this->web_user); + $comments[] = $this->postComment($this->node1, $this->randomName(), $this->randomName()); + + // Tests the reply_of relationship of a first level comment. + $result = $this->xpath("id('comments')//div[@class='comment' and position()=0]//span[@rel='sioc:reply_of' and @resource=:node]", array(':node' => url("node/{$this->node1->nid}"))); + $this->assertEqual(1, count($result), t('RDFa markup referring to the node is present.')); + $result = $this->xpath("id('comments')//div[@class='comment' and position()=0]//span[@rel='sioc:reply_of' and @resource=:comment]", array(':comment' => url('comment/1#comment-1'))); + $this->assertFalse($result, t('No RDFa markup referring to the comment itself is present.')); + + // Posts a reply to the first comment. + $this->drupalGet('comment/reply/' . $this->node1->nid . '/' . $comments[0]->id); + $comments[] = $this->postComment(NULL, $this->randomName(), $this->randomName(), TRUE); + + // Tests the reply_of relationship of a second level comment. + $result = $this->xpath("id('comments')//div[@class='comment' and position()=1]//span[@rel='sioc:reply_of' and @resource=:node]", array(':node' => url("node/{$this->node1->nid}"))); + $this->assertEqual(1, count($result), t('RDFa markup referring to the node is present.')); + $result = $this->xpath("id('comments')//div[@class='comment' and position()=1]//span[@rel='sioc:reply_of' and @resource=:comment]", array(':comment' => url('comment/1#comment-1'))); + $this->assertEqual(1, count($result), t('RDFa markup referring to the parent comment is present.')); + } + /** * Helper function for testCommentRdfaMarkup(). * * Tests the current page for basic comment RDFa markup. |