protected function StandardProfileTest::assertRdfaNodeCommentProperties in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/rdf/src/Tests/StandardProfileTest.php \Drupal\rdf\Tests\StandardProfileTest::assertRdfaNodeCommentProperties()
Tests output for comment properties on nodes in full page view mode.
Parameters
\EasyRdf_Graph $graph: The EasyRDF graph object.
1 call to StandardProfileTest::assertRdfaNodeCommentProperties()
- StandardProfileTest::doArticleRdfaTests in core/
modules/ rdf/ src/ Tests/ StandardProfileTest.php - Tests that article data is exposed using RDFa.
File
- core/
modules/ rdf/ src/ Tests/ StandardProfileTest.php, line 430 - Contains \Drupal\rdf\Tests\StandardProfileTest.
Class
- StandardProfileTest
- Tests the RDF mappings and RDFa markup of the standard profile.
Namespace
Drupal\rdf\TestsCode
protected function assertRdfaNodeCommentProperties($graph) {
// Relationship between node and comment.
$expected_value = array(
'type' => 'uri',
'value' => $this->articleCommentUri,
);
$this
->assertTrue($graph
->hasProperty($this->articleUri, 'http://schema.org/comment', $expected_value), 'Relationship between node and comment found (schema:comment).');
// Comment type.
$this
->assertEqual($graph
->type($this->articleCommentUri), 'schema:Comment', 'Comment type was found (schema:Comment).');
// Comment title.
$expected_value = array(
'type' => 'literal',
'value' => $this->articleComment
->get('subject')->value,
'lang' => 'en',
);
$this
->assertTrue($graph
->hasProperty($this->articleCommentUri, 'http://schema.org/name', $expected_value), 'Article comment title was found (schema:name).');
// Comment created date.
$expected_value = array(
'type' => 'literal',
'value' => format_date($this->articleComment
->get('created')->value, 'custom', 'c', 'UTC'),
'lang' => 'en',
);
$this
->assertTrue($graph
->hasProperty($this->articleCommentUri, 'http://schema.org/dateCreated', $expected_value), 'Article comment created date was found (schema:dateCreated).');
// Comment body.
$text = $this->articleComment
->get('comment_body')->value;
$expected_value = array(
'type' => 'literal',
// There is an extra carriage return in the when parsing comments as
// output by Bartik, so it must be added to the expected value.
'value' => "{$text}\n",
'lang' => 'en',
);
$this
->assertTrue($graph
->hasProperty($this->articleCommentUri, 'http://schema.org/text', $expected_value), 'Article comment body was found (schema:text).');
// Comment uid.
$expected_value = array(
'type' => 'uri',
'value' => $this->commenterUri,
);
$this
->assertTrue($graph
->hasProperty($this->articleCommentUri, 'http://schema.org/author', $expected_value), 'Article comment author was found (schema:author).');
// Comment author type.
$this
->assertEqual($graph
->type($this->commenterUri), 'schema:Person', 'Comment author type was found (schema:Person).');
// Comment author name.
$expected_value = array(
'type' => 'literal',
'value' => $this->webUser
->getUsername(),
);
$this
->assertTrue($graph
->hasProperty($this->commenterUri, 'http://schema.org/name', $expected_value), 'Comment author name was found (schema:name).');
}