$this->assertTrue($graph->hasProperty($node_uri,'http://rdfs.org/sioc/ns#num_replies',$expected_value),'Number of comments found in RDF output (sioc:num_replies).');
// Node relation to author.
$expected_value=array(
'type'=>'uri',
'value'=>$user_uri,
);
if($node->uid==0){
$this->assertTrue(empty($tracker_user),format_string('No about attribute is present on @user.',array('@user'=>$user)));
$this->assertFalse($graph->hasProperty($node_uri,'http://rdfs.org/sioc/ns#has_creator',$expected_value),'No relation to author found in RDF output (sioc:has_creator).');
}
elseif($node->uid>0){
$this->assertTrue(!empty($tracker_user),format_string('About attribute is present on @user.',array('@user'=>$user)));
$this->assertTrue($graph->hasProperty($node_uri,'http://rdfs.org/sioc/ns#has_creator',$expected_value),'Relation to author found in RDF output (sioc:has_creator).');
$this->assertTrue($graph->hasProperty($node_uri,'http://rdfs.org/sioc/ns#last_activity_date',$expected_value),'Last activity date found in RDF output (sioc:last_activity_date).');
// 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,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),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.
// Adds new comment to ensure the tracker is updated accordingly.
// 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,format_string('Num replies property and content attributes found on @user content.',array('@user'=>$user)));
// Parses tracker page where the nodes are displayed in a table.
$this->assertTrue($graph->hasProperty($node_uri,'http://rdfs.org/sioc/ns#num_replies',$expected_value),'Number of comments found in RDF output (sioc:num_replies).');
// Last updated due to new comment.
// last_activity_date needs to be queried from the database directly because
// it cannot be accessed via node_load().
$result=db_query('SELECT t.changed FROM {tracker_node} t WHERE t.nid = (:nid)',array(':nid'=>$node->nid));
foreach($resultas$node){
$expected_last_activity_date=$node->changed;
}
$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),format_string('Latest activity date found when there are comments on @user content. Latest activity date content is correct.',array('@user'=>$user)));
$expected_last_activity_date=db_query('SELECT t.changed FROM {tracker_node} t WHERE t.nid = (:nid)',array(':nid'=>$node->nid))->fetchField();
$this->assertTrue($graph->hasProperty($node_uri,'http://rdfs.org/sioc/ns#last_activity_date',$expected_value),'Last activity date after new comment has been posted found in RDF output (sioc:last_activity_date).');