| 7 rdf.test | RdfCommentAttributesTestCase::_testBasicCommentRdfaMarkup($comment, $account = array()) |
| 8 rdf.test | RdfCommentAttributesTestCase::_testBasicCommentRdfaMarkup($comment, $account = array()) |
Helper function for testCommentRdfaMarkup().
Tests the current page for basic comment RDFa markup.
Parameters
$comment: Comment object.
$account: An array containing information about an anonymous user.
File
- modules/
rdf/ rdf.test, line 559 - Tests for rdf.module.
Code
function _testBasicCommentRdfaMarkup($comment, $account = array()) {
$comment_container = $this->xpath('//div[contains(@class, "comment") and contains(@typeof, "sioct:Comment")]');
$this->assertTrue(!empty($comment_container), t("Comment RDF type for comment found."));
$comment_title = $this->xpath('//div[contains(@class, "comment") and contains(@typeof, "sioct:Comment")]//h3[@property="dc:title"]');
$this->assertEqual((string) $comment_title[0]->a, $comment->subject, t("RDFa markup for the comment title found."));
$comment_date = $this->xpath('//div[contains(@class, "comment") and contains(@typeof, "sioct:Comment")]//*[contains(@property, "dc:date") and contains(@property, "dc:created")]');
$this->assertTrue(!empty($comment_date), t("RDFa markup for the date of the comment found."));
// The author tag can be either a or span
$comment_author = $this->xpath('//div[contains(@class, "comment") and contains(@typeof, "sioct:Comment")]//span[@rel="sioc:has_creator"]/*[contains(@class, "username") and @typeof="sioc:UserAccount" and @property="foaf:name"]');
$name = empty($account["name"]) ? $this->web_user->name : $account["name"] . " (not verified)";
$this->assertEqual((string) $comment_author[0], $name, t("RDFa markup for the comment author found."));
$comment_body = $this->xpath('//div[contains(@class, "comment") and contains(@typeof, "sioct:Comment")]//div[@class="content"]//div[contains(@class, "comment-body")]//div[@property="content:encoded"]');
$this->assertEqual((string) $comment_body[0]->p, $comment->comment, t("RDFa markup for the comment body found."));
}
Login or register to post comments