Commit 5ffd2a64 authored by jhodgdon's avatar jhodgdon

Issue #1797506 by xjm, Lars Toomre: Remove t() from test assertions in RDF module

parent 74e72569
......@@ -76,15 +76,15 @@ public function testNumberOfCommentsRdfaMarkup() {
// Tests number of comments in teaser view.
$this->drupalGet('node');
$comment_count_teaser = $this->xpath('//div[contains(@typeof, "sioc:Item")]//li[contains(@class, "comment-comments")]/a[contains(@property, "sioc:num_replies") and contains(@content, "2") and @datatype="xsd:integer"]');
$this->assertTrue(!empty($comment_count_teaser), t('RDFa markup for the number of comments found on teaser view.'));
$this->assertTrue(!empty($comment_count_teaser), 'RDFa markup for the number of comments found on teaser view.');
$comment_count_link = $this->xpath('//div[@about=:url]//a[contains(@property, "sioc:num_replies") and @rel=""]', array(':url' => url("node/{$this->node1->nid}")));
$this->assertTrue(!empty($comment_count_link), t('Empty rel attribute found in comment count link.'));
$this->assertTrue(!empty($comment_count_link), 'Empty rel attribute found in comment count link.');
// Tests number of comments in full node view.
$this->drupalGet('node/' . $this->node1->nid);
$node_url = url('node/' . $this->node1->nid);
$comment_count_teaser = $this->xpath('/html/head/meta[@about=:node-url and @property="sioc:num_replies" and @content="2" and @datatype="xsd:integer"]', array(':node-url' => $node_url));
$this->assertTrue(!empty($comment_count_teaser), t('RDFa markup for the number of comments found on full node view.'));
$this->assertTrue(!empty($comment_count_teaser), 'RDFa markup for the number of comments found on full node view.');
}
/**
......@@ -124,10 +124,10 @@ public function testCommentRdfaMarkup() {
$this->_testBasicCommentRdfaMarkup($comment2, $anonymous_user);
// Tests the RDFa markup for the homepage (specific to anonymous comments).
$comment_homepage = $this->xpath('//div[contains(@class, "comment") and contains(@typeof, "sioct:Comment")]//span[@rel="sioc:has_creator"]/a[contains(@class, "username") and @typeof="sioc:UserAccount" and @property="foaf:name" and @href="http://example.org/" and contains(@rel, "foaf:page")]');
$this->assertTrue(!empty($comment_homepage), t('RDFa markup for the homepage of anonymous user found.'));
$this->assertTrue(!empty($comment_homepage), 'RDFa markup for the homepage of anonymous user found.');
// There should be no about attribute on anonymous comments.
$comment_homepage = $this->xpath('//div[contains(@class, "comment") and contains(@typeof, "sioct:Comment")]//span[@rel="sioc:has_creator"]/a[@about]');
$this->assertTrue(empty($comment_homepage), t('No about attribute is present on anonymous user comment.'));
$this->assertTrue(empty($comment_homepage), 'No about attribute is present on anonymous user comment.');
// Tests comment #2 as logged in user.
$this->drupalLogin($this->web_user);
......@@ -135,10 +135,10 @@ public function testCommentRdfaMarkup() {
$this->_testBasicCommentRdfaMarkup($comment2, $anonymous_user);
// Tests the RDFa markup for the homepage (specific to anonymous comments).
$comment_homepage = $this->xpath('//div[contains(@class, "comment") and contains(@typeof, "sioct:Comment")]//span[@rel="sioc:has_creator"]/a[contains(@class, "username") and @typeof="sioc:UserAccount" and @property="foaf:name" and @href="http://example.org/" and contains(@rel, "foaf:page")]');
$this->assertTrue(!empty($comment_homepage), t("RDFa markup for the homepage of anonymous user found."));
$this->assertTrue(!empty($comment_homepage), "RDFa markup for the homepage of anonymous user found.");
// There should be no about attribute on anonymous comments.
$comment_homepage = $this->xpath('//div[contains(@class, "comment") and contains(@typeof, "sioct:Comment")]//span[@rel="sioc:has_creator"]/a[@about]');
$this->assertTrue(empty($comment_homepage), t("No about attribute is present on anonymous user comment."));
$this->assertTrue(empty($comment_homepage), "No about attribute is present on anonymous user comment.");
}
/**
......@@ -151,9 +151,9 @@ public function testCommentReplyOfRdfaMarkup() {
// Tests the reply_of relationship of a first level comment.
$result = $this->xpath("(id('comments')//div[contains(@class,'comment ')])[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.'));
$this->assertEqual(1, count($result), 'RDFa markup referring to the node is present.');
$result = $this->xpath("(id('comments')//div[contains(@class,'comment ')])[position()=1]//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.'));
$this->assertFalse($result, '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);
......@@ -161,9 +161,9 @@ public function testCommentReplyOfRdfaMarkup() {
// Tests the reply_of relationship of a second level comment.
$result = $this->xpath("(id('comments')//div[contains(@class,'comment ')])[position()=2]//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.'));
$this->assertEqual(1, count($result), 'RDFa markup referring to the node is present.');
$result = $this->xpath("(id('comments')//div[contains(@class,'comment ')])[position()=2]//span[@rel='sioc:reply_of' and @resource=:comment]", array(':comment' => url('comment/1', array('fragment' => 'comment-1'))));
$this->assertEqual(1, count($result), t('RDFa markup referring to the parent comment is present.'));
$this->assertEqual(1, count($result), 'RDFa markup referring to the parent comment is present.');
$comments = $this->xpath("(id('comments')//div[contains(@class,'comment ')])[position()=2]");
}
......@@ -179,16 +179,16 @@ public function testCommentReplyOfRdfaMarkup() {
*/
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."));
$this->assertTrue(!empty($comment_container), '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."));
$this->assertEqual((string) $comment_title[0]->a, $comment->subject, '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."));
$this->assertTrue(!empty($comment_date), '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."));
$this->assertEqual((string) $comment_author[0], $name, '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."));
$this->assertEqual((string) $comment_body[0]->p, $comment->comment, 'RDFa markup for the comment body found.');
}
}
......@@ -35,7 +35,7 @@ public static function getInfo() {
function testCRUD() {
// Verify loading of a default mapping.
$mapping = _rdf_mapping_load('test_entity', 'test_bundle');
$this->assertTrue(count($mapping), t('Default mapping was found.'));
$this->assertTrue(count($mapping), 'Default mapping was found.');
// Verify saving a mapping.
$mapping = array(
......@@ -52,34 +52,34 @@ function testCRUD() {
),
),
);
$this->assertTrue(rdf_mapping_save($mapping) === SAVED_NEW, t('Mapping was saved.'));
$this->assertTrue(rdf_mapping_save($mapping) === SAVED_NEW, 'Mapping was saved.');
// Read the raw record from the {rdf_mapping} table.
$result = db_query('SELECT * FROM {rdf_mapping} WHERE type = :type AND bundle = :bundle', array(':type' => $mapping['type'], ':bundle' => $mapping['bundle']));
$stored_mapping = $result->fetchAssoc();
$stored_mapping['mapping'] = unserialize($stored_mapping['mapping']);
$this->assertEqual($mapping, $stored_mapping, t('Mapping was stored properly in the {rdf_mapping} table.'));
$this->assertEqual($mapping, $stored_mapping, 'Mapping was stored properly in the {rdf_mapping} table.');
// Verify loading of saved mapping.
$this->assertEqual($mapping['mapping'], _rdf_mapping_load($mapping['type'], $mapping['bundle']), t('Saved mapping loaded successfully.'));
$this->assertEqual($mapping['mapping'], _rdf_mapping_load($mapping['type'], $mapping['bundle']), 'Saved mapping loaded successfully.');
// Verify updating of mapping.
$mapping['mapping']['title'] = array(
'predicates' => array('dc2:bar2'),
);
$this->assertTrue(rdf_mapping_save($mapping) === SAVED_UPDATED, t('Mapping was updated.'));
$this->assertTrue(rdf_mapping_save($mapping) === SAVED_UPDATED, 'Mapping was updated.');
// Read the raw record from the {rdf_mapping} table.
$result = db_query('SELECT * FROM {rdf_mapping} WHERE type = :type AND bundle = :bundle', array(':type' => $mapping['type'], ':bundle' => $mapping['bundle']));
$stored_mapping = $result->fetchAssoc();
$stored_mapping['mapping'] = unserialize($stored_mapping['mapping']);
$this->assertEqual($mapping, $stored_mapping, t('Updated mapping was stored properly in the {rdf_mapping} table.'));
$this->assertEqual($mapping, $stored_mapping, 'Updated mapping was stored properly in the {rdf_mapping} table.');
// Verify loading of saved mapping.
$this->assertEqual($mapping['mapping'], _rdf_mapping_load($mapping['type'], $mapping['bundle']), t('Saved mapping loaded successfully.'));
$this->assertEqual($mapping['mapping'], _rdf_mapping_load($mapping['type'], $mapping['bundle']), 'Saved mapping loaded successfully.');
// Verify deleting of mapping.
$this->assertTrue(rdf_mapping_delete($mapping['type'], $mapping['bundle']), t('Mapping was deleted.'));
$this->assertFalse(_rdf_mapping_load($mapping['type'], $mapping['bundle']), t('Deleted mapping is no longer found in the database.'));
$this->assertTrue(rdf_mapping_delete($mapping['type'], $mapping['bundle']), 'Mapping was deleted.');
$this->assertFalse(_rdf_mapping_load($mapping['type'], $mapping['bundle']), 'Deleted mapping is no longer found in the database.');
}
}
......@@ -39,21 +39,21 @@ function testGetRdfNamespaces() {
$element = $this->xpath('//html[contains(@prefix, :prefix_binding)]', array(
':prefix_binding' => 'rdfs: http://www.w3.org/2000/01/rdf-schema#',
));
$this->assertTrue(!empty($element), t('A prefix declared once is displayed.'));
$this->assertTrue(!empty($element), 'A prefix declared once is displayed.');
$element = $this->xpath('//html[contains(@prefix, :prefix_binding)]', array(
':prefix_binding' => 'foaf: http://xmlns.com/foaf/0.1/',
));
$this->assertTrue(!empty($element), t('The same prefix declared in several implementations of hook_rdf_namespaces() is valid as long as all the namespaces are the same.'));
$this->assertTrue(!empty($element), 'The same prefix declared in several implementations of hook_rdf_namespaces() is valid as long as all the namespaces are the same.');
$element = $this->xpath('//html[contains(@prefix, :prefix_binding)]', array(
':prefix_binding' => 'foaf1: http://xmlns.com/foaf/0.1/',
));
$this->assertTrue(!empty($element), t('Two prefixes can be assigned the same namespace.'));
$this->assertTrue(!empty($element), 'Two prefixes can be assigned the same namespace.');
$element = $this->xpath('//html[contains(@prefix, :prefix_binding)]', array(
':prefix_binding' => 'dc: ',
));
$this->assertTrue(empty($element), t('A prefix with conflicting namespaces is discarded.'));
$this->assertTrue(empty($element), 'A prefix with conflicting namespaces is discarded.');
}
}
......@@ -36,9 +36,9 @@ function testGetRdfNamespaces() {
// Get all RDF namespaces.
$ns = rdf_get_namespaces();
$this->assertEqual($ns['rdfs'], 'http://www.w3.org/2000/01/rdf-schema#', t('A prefix declared once is included.'));
$this->assertEqual($ns['foaf'], 'http://xmlns.com/foaf/0.1/', t('The same prefix declared in several implementations of hook_rdf_namespaces() is valid as long as all the namespaces are the same.'));
$this->assertEqual($ns['foaf1'], 'http://xmlns.com/foaf/0.1/', t('Two prefixes can be assigned the same namespace.'));
$this->assertTrue(!isset($ns['dc']), t('A prefix with conflicting namespaces is discarded.'));
$this->assertEqual($ns['rdfs'], 'http://www.w3.org/2000/01/rdf-schema#', 'A prefix declared once is included.');
$this->assertEqual($ns['foaf'], 'http://xmlns.com/foaf/0.1/', 'The same prefix declared in several implementations of hook_rdf_namespaces() is valid as long as all the namespaces are the same.');
$this->assertEqual($ns['foaf1'], 'http://xmlns.com/foaf/0.1/', 'Two prefixes can be assigned the same namespace.');
$this->assertTrue(!isset($ns['dc']), 'A prefix with conflicting namespaces is discarded.');
}
}
......@@ -45,8 +45,8 @@ function testAttributesInMarkup1() {
// from the node default bundle definition.
$node_title = $this->xpath("//meta[@property='dc:title' and @content='$node->title']");
$node_meta = $this->xpath("//div[(@about='$url')]//span[contains(@property, 'dc:date') and contains(@property, 'dc:created') and @datatype='xsd:dateTime' and @content='$isoDate']");
$this->assertTrue(!empty($node_title), t('Property dc:title is present in meta tag.'));
$this->assertTrue(!empty($node_meta), t('RDF type is present on post. Properties dc:date and dc:created are present on post date.'));
$this->assertTrue(!empty($node_title), 'Property dc:title is present in meta tag.');
$this->assertTrue(!empty($node_meta), 'RDF type is present on post. Properties dc:date and dc:created are present on post date.');
}
/**
......@@ -65,8 +65,8 @@ function testAttributesInMarkup2() {
// Ensure the mapping defined in rdf_module.test is used.
$test_bundle_title = $this->xpath("//meta[@property='dc:title' and @content='$node->title']");
$test_bundle_meta = $this->xpath("//div[(@about='$url') and contains(@typeof, 'foo:mapping_install1') and contains(@typeof, 'bar:mapping_install2')]//span[contains(@property, 'dc:date') and contains(@property, 'dc:created') and @datatype='xsd:dateTime' and @content='$isoDate']");
$this->assertTrue(!empty($test_bundle_title), t('Property dc:title is present in meta tag.'));
$this->assertTrue(!empty($test_bundle_meta), t('RDF type is present on post. Properties dc:date and dc:created are present on post date.'));
$this->assertTrue(!empty($test_bundle_title), 'Property dc:title is present in meta tag.');
$this->assertTrue(!empty($test_bundle_meta), 'RDF type is present on post. Properties dc:date and dc:created are present on post date.');
}
/**
......@@ -86,8 +86,8 @@ function testAttributesInMarkup3() {
// from the node default bundle definition.
$random_bundle_title = $this->xpath("//meta[@property='dc:title' and @content='$node->title']");
$random_bundle_meta = $this->xpath("//div[(@about='$url') and contains(@typeof, 'sioc:Item') and contains(@typeof, 'foaf:Document')]//span[contains(@property, 'dc:date') and contains(@property, 'dc:created') and @datatype='xsd:dateTime' and @content='$isoDate']");
$this->assertTrue(!empty($random_bundle_title), t('Property dc:title is present in meta tag.'));
$this->assertTrue(!empty($random_bundle_meta), t('RDF type is present on post. Properties dc:date and dc:created are present on post date.'));
$this->assertTrue(!empty($random_bundle_title), 'Property dc:title is present in meta tag.');
$this->assertTrue(!empty($random_bundle_meta), 'RDF type is present on post. Properties dc:date and dc:created are present on post date.');
}
/**
......@@ -112,19 +112,19 @@ function testUserAttributesInMarkup() {
$user2_profile_about = $this->xpath('//article[@class="profile" and @typeof="sioc:UserAccount" and @about=:account-uri]', array(
':account-uri' => $account_uri,
));
$this->assertTrue(!empty($user2_profile_about), t('RDFa markup found on user profile page'));
$this->assertTrue(!empty($user2_profile_about), 'RDFa markup found on user profile page');
$user_account_holder = $this->xpath('//meta[contains(@typeof, "foaf:Person") and @about=:person-uri and @resource=:account-uri and contains(@rel, "foaf:account")]', array(
':person-uri' => $person_uri,
':account-uri' => $account_uri,
));
$this->assertTrue(!empty($user_account_holder), t('URI created for account holder and username set on sioc:UserAccount.'));
$this->assertTrue(!empty($user_account_holder), 'URI created for account holder and username set on sioc:UserAccount.');
$user_username = $this->xpath('//meta[@about=:account-uri and contains(@property, "foaf:name") and @content=:username]', array(
':account-uri' => $account_uri,
':username' => $username,
));
$this->assertTrue(!empty($user_username), t('foaf:name set on username.'));
$this->assertTrue(!empty($user_username), 'foaf:name set on username.');
// User 2 creates node.
$this->drupalLogin($user2);
......@@ -136,7 +136,7 @@ function testUserAttributesInMarkup() {
$author_about = $this->xpath('//a[@typeof="sioc:UserAccount" and @about=:account-uri and @property="foaf:name" and contains(@lang, "")]', array(
':account-uri' => $account_uri,
));
$this->assertTrue(!empty($author_about), t('RDFa markup found on author information on post. The lang attribute on username is set to empty string.'));
$this->assertTrue(!empty($author_about), 'RDFa markup found on author information on post. The lang attribute on username is set to empty string.');
}
/**
......@@ -154,6 +154,6 @@ function testTaxonomyTermRdfaAttributes() {
':term-url' => $term_url,
':term-label' => $term_label,
));
$this->assertTrue(!empty($term_rdfa_meta), t('RDFa markup found on term page.'));
$this->assertTrue(!empty($term_rdfa_meta), 'RDFa markup found on term page.');
}
}
......@@ -35,16 +35,16 @@ public static function getInfo() {
function testMapping() {
// Test that the mapping is returned correctly by the hook.
$mapping = rdf_mapping_load('test_entity', 'test_bundle');
$this->assertIdentical($mapping['rdftype'], array('sioc:Post'), t('Mapping for rdftype is sioc:Post.'));
$this->assertIdentical($mapping['title'], array('predicates' => array('dc:title')), t('Mapping for title is dc:title.'));
$this->assertIdentical($mapping['rdftype'], array('sioc:Post'), 'Mapping for rdftype is sioc:Post.');
$this->assertIdentical($mapping['title'], array('predicates' => array('dc:title')), 'Mapping for title is dc:title.');
$this->assertIdentical($mapping['created'], array(
'predicates' => array('dc:created'),
'datatype' => 'xsd:dateTime',
'callback' => 'date_iso8601',
), t('Mapping for created is dc:created with datatype xsd:dateTime and callback date_iso8601.'));
$this->assertIdentical($mapping['uid'], array('predicates' => array('sioc:has_creator', 'dc:creator'), 'type' => 'rel'), t('Mapping for uid is sioc:has_creator and dc:creator, and type is rel.'));
), 'Mapping for created is dc:created with datatype xsd:dateTime and callback date_iso8601.');
$this->assertIdentical($mapping['uid'], array('predicates' => array('sioc:has_creator', 'dc:creator'), 'type' => 'rel'), 'Mapping for uid is sioc:has_creator and dc:creator, and type is rel.');
$mapping = rdf_mapping_load('test_entity', 'test_bundle_no_mapping');
$this->assertEqual($mapping, array(), t('Empty array returned when an entity type, bundle pair has no mapping.'));
$this->assertEqual($mapping, array(), 'Empty array returned when an entity type, bundle pair has no mapping.');
}
}
......@@ -158,13 +158,13 @@ function testAttributesInMarkupFile() {
$file_rel = $this->xpath('//div[contains(@about, :node-uri)]//div[contains(@rel, "rdfs:seeAlso") and contains(@resource, ".txt")]', array(
':node-uri' => 'node/' . $nid,
));
$this->assertTrue(!empty($file_rel), t('Attribute \'rel\' set on file field. Attribute \'resource\' is also set.'));
$this->assertTrue(!empty($file_rel), "Attribute 'rel' set on file field. Attribute 'resource' is also set.");
$image_rel = $this->xpath('//div[contains(@about, :node-uri)]//div[contains(@rel, "rdfs:seeAlso") and contains(@resource, :image)]//img[contains(@typeof, "foaf:Image")]', array(
':node-uri' => 'node/' . $nid,
':image' => $image_filename,
));
$this->assertTrue(!empty($image_rel), t('Attribute \'rel\' set on image field. Attribute \'resource\' is also set.'));
$this->assertTrue(!empty($image_rel), "Attribute 'rel' set on image field. Attribute 'resource' is also set.");
// Edits the node to add tags.
$tag1 = $this->randomName(8);
......@@ -178,11 +178,11 @@ function testAttributesInMarkupFile() {
':node-url' => url('node/' . $node->nid),
':term-name' => $tag1,
));
$this->assertTrue(!empty($term_rdfa_meta), t('Property dc:subject is present for the tag1 field item.'));
$this->assertTrue(!empty($term_rdfa_meta), 'Property dc:subject is present for the tag1 field item.');
$term_rdfa_meta = $this->xpath('//div[@about=:node-url and contains(@typeof, "sioc:Item") and contains(@typeof, "foaf:Document")]//ul[@class="links"]/li[@rel="dc:subject"]/a[@typeof="skos:Concept" and text()=:term-name]', array(
':node-url' => url('node/' . $node->nid),
':term-name' => $tag2,
));
$this->assertTrue(!empty($term_rdfa_meta), t('Property dc:subject is present for the tag2 field item.'));
$this->assertTrue(!empty($term_rdfa_meta), 'Property dc:subject is present for the tag2 field item.');
}
}
......@@ -83,35 +83,35 @@ function _testBasicTrackerRdfaMarkup(Node $node) {
// success of the following tests, but making it explicit will make
// debugging easier in case of failure.
$tracker_about = $this->xpath('//tr[@about=:url]', array(':url' => $url));
$this->assertTrue(!empty($tracker_about), t('About attribute found on table row for @user content.', array('@user'=> $user)));
$this->assertTrue(!empty($tracker_about), format_string('About attribute found on table row for @user content.', array('@user'=> $user)));
// Tests whether the title has the correct property attribute.
$tracker_title = $this->xpath('//tr[@about=:url]/td[@property="dc:title" and @datatype=""]', array(':url' => $url));
$this->assertTrue(!empty($tracker_title), t('Title property attribute found on @user content.', array('@user'=> $user)));
$this->assertTrue(!empty($tracker_title), format_string('Title property attribute found on @user content.', array('@user'=> $user)));
// Tests whether the relationship between the content and user has been set.
$tracker_user = $this->xpath('//tr[@about=:url]//td[contains(@rel, "sioc:has_creator")]//*[contains(@typeof, "sioc:UserAccount") and contains(@property, "foaf:name")]', array(':url' => $url));
$this->assertTrue(!empty($tracker_user), t('Typeof and name property attributes found on @user.', array('@user'=> $user)));
$this->assertTrue(!empty($tracker_user), format_string('Typeof and name property attributes found on @user.', array('@user'=> $user)));
// There should be an about attribute on logged in users and no about
// attribute for anonymous users.
$tracker_user = $this->xpath('//tr[@about=:url]//td[@rel="sioc:has_creator"]/*[@about]', array(':url' => $url));
if ($node->uid == 0) {
$this->assertTrue(empty($tracker_user), t('No about attribute is present on @user.', array('@user'=> $user)));
$this->assertTrue(empty($tracker_user), format_string('No about attribute is present on @user.', array('@user'=> $user)));
}
elseif ($node->uid > 0) {
$this->assertTrue(!empty($tracker_user), t('About attribute is present on @user.', array('@user'=> $user)));
$this->assertTrue(!empty($tracker_user), format_string('About attribute is present on @user.', array('@user'=> $user)));
}
// Tests whether the property has been set for number of comments.
$tracker_replies = $this->xpath('//tr[@about=:url]//td[contains(@property, "sioc:num_replies") and contains(@content, "0") and @datatype="xsd:integer"]', array(':url' => $url));
$this->assertTrue($tracker_replies, t('Num replies property and content attributes found on @user content.', array('@user'=> $user)));
$this->assertTrue($tracker_replies, format_string('Num replies property and content attributes found on @user content.', array('@user'=> $user)));
// Tests that the appropriate RDFa markup to annotate the latest activity
// date has been added to the tracker output before comments have been
// posted, meaning the latest activity reflects changes to the node itself.
$isoDate = date('c', $node->changed);
$tracker_activity = $this->xpath('//tr[@about=:url]//td[contains(@property, "dc:modified") and contains(@property, "sioc:last_activity_date") and contains(@datatype, "xsd:dateTime") and @content=:date]', array(':url' => $url, ':date' => $isoDate));
$this->assertTrue(!empty($tracker_activity), t('Latest activity date and changed properties found when there are no comments on @user content. Latest activity date content is correct.', array('@user'=> $user)));
$this->assertTrue(!empty($tracker_activity), format_string('Latest activity date and changed properties found when there are no comments on @user content. Latest activity date content is correct.', array('@user'=> $user)));
// Tests that the appropriate RDFa markup to annotate the latest activity
// date has been added to the tracker output after a comment is posted.
......@@ -124,7 +124,7 @@ function _testBasicTrackerRdfaMarkup(Node $node) {
// Tests whether the property has been set for number of comments.
$tracker_replies = $this->xpath('//tr[@about=:url]//td[contains(@property, "sioc:num_replies") and contains(@content, "1") and @datatype="xsd:integer"]', array(':url' => $url));
$this->assertTrue($tracker_replies, t('Num replies property and content attributes found on @user content.', array('@user'=> $user)));
$this->assertTrue($tracker_replies, format_string('Num replies property and content attributes found on @user content.', array('@user'=> $user)));
// Need to query database directly to obtain last_activity_date because
// it cannot be accessed via node_load().
......@@ -134,6 +134,6 @@ function _testBasicTrackerRdfaMarkup(Node $node) {
}
$isoDate = date('c', $expected_last_activity_date);
$tracker_activity = $this->xpath('//tr[@about=:url]//td[@property="sioc:last_activity_date" and @datatype="xsd:dateTime" and @content=:date]', array(':url' => $url, ':date' => $isoDate));
$this->assertTrue(!empty($tracker_activity), t('Latest activity date found when there are comments on @user content. Latest activity date content is correct.', array('@user'=> $user)));
$this->assertTrue(!empty($tracker_activity), format_string('Latest activity date found when there are comments on @user content. Latest activity date content is correct.', array('@user'=> $user)));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment