protected function StandardProfileTest::assertRdfaCommonNodeProperties in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/rdf/src/Tests/StandardProfileTest.php \Drupal\rdf\Tests\StandardProfileTest::assertRdfaCommonNodeProperties()
Tests output for properties held in common between articles and pages.
Parameters
\EasyRdf_Graph $graph: The EasyRDF graph object.
\Drupal\node\NodeInterface $node: The node being displayed.
string $message_prefix: The word to use in the test assertion message.
3 calls to StandardProfileTest::assertRdfaCommonNodeProperties()
- StandardProfileTest::doArticleRdfaTests in core/
modules/ rdf/ src/ Tests/ StandardProfileTest.php - Tests that article data is exposed using RDFa.
- StandardProfileTest::doFrontPageRdfaTests in core/
modules/ rdf/ src/ Tests/ StandardProfileTest.php - Tests that data is exposed in the front page teasers.
- StandardProfileTest::doPageRdfaTests in core/
modules/ rdf/ src/ Tests/ StandardProfileTest.php - Tests that page data is exposed using RDFa.
File
- core/
modules/ rdf/ src/ Tests/ StandardProfileTest.php, line 349 - Contains \Drupal\rdf\Tests\StandardProfileTest.
Class
- StandardProfileTest
- Tests the RDF mappings and RDFa markup of the standard profile.
Namespace
Drupal\rdf\TestsCode
protected function assertRdfaCommonNodeProperties($graph, NodeInterface $node, $message_prefix) {
$uri = $node
->url('canonical', array(
'absolute' => TRUE,
));
// Title.
$expected_value = array(
'type' => 'literal',
'value' => $node
->get('title')->value,
'lang' => 'en',
);
$this
->assertTrue($graph
->hasProperty($uri, 'http://schema.org/name', $expected_value), "{$message_prefix} title was found (schema:name).");
// Created date.
$expected_value = array(
'type' => 'literal',
'value' => format_date($node
->get('created')->value, 'custom', 'c', 'UTC'),
'lang' => 'en',
);
$this
->assertTrue($graph
->hasProperty($uri, 'http://schema.org/dateCreated', $expected_value), "{$message_prefix} created date was found (schema:dateCreated) in teaser.");
// Body.
$expected_value = array(
'type' => 'literal',
'value' => $node
->get('body')->value,
'lang' => 'en',
);
$this
->assertTrue($graph
->hasProperty($uri, 'http://schema.org/text', $expected_value), "{$message_prefix} body was found (schema:text) in teaser.");
// Author.
$expected_value = array(
'type' => 'uri',
'value' => $this->authorUri,
);
$this
->assertTrue($graph
->hasProperty($uri, 'http://schema.org/author', $expected_value), "{$message_prefix} author was found (schema:author) in teaser.");
// Author type.
$this
->assertEqual($graph
->type($this->authorUri), 'schema:Person', "{$message_prefix} author type was found (schema:Person).");
// Author name.
$expected_value = array(
'type' => 'literal',
'value' => $this->adminUser
->label(),
);
$this
->assertTrue($graph
->hasProperty($this->authorUri, 'http://schema.org/name', $expected_value), "{$message_prefix} author name was found (schema:name).");
}