From a6735f57ff88d8034deaa8191776facf4ebd64dc Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Thu, 22 Apr 2010 08:12:30 +0000 Subject: #691692 by Stefan Freudenberg, linclark: Improve RDF tests. --- modules/comment/comment.test | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'modules/comment') 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 @@ -1198,6 +1198,30 @@ class CommentRdfaTestCase extends CommentHelperCase { $this->assertTrue(empty($comment_homepage), t("No about attribute is present on anonymous user comment.")); } + /** + * 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(). * -- cgit v1.2.3