function FileFieldAttributesTest::testNodeTeaser
Same name in other branches
- 8.9.x core/modules/rdf/tests/src/Functional/FileFieldAttributesTest.php \Drupal\Tests\rdf\Functional\FileFieldAttributesTest::testNodeTeaser()
Tests if file fields in teasers have correct resources.
Ensure that file fields have the correct resource as the object in RDFa when displayed as a teaser.
File
-
core/
modules/ rdf/ tests/ src/ Functional/ FileFieldAttributesTest.php, line 100
Class
- FileFieldAttributesTest
- Tests the RDFa markup of filefields.
Namespace
Drupal\Tests\rdf\FunctionalCode
public function testNodeTeaser() {
// Render the teaser.
$node_render_array = \Drupal::entityTypeManager()->getViewBuilder('node')
->view($this->node, 'teaser');
$html = \Drupal::service('renderer')->renderRoot($node_render_array);
$node_uri = $this->node
->toUrl('canonical', [
'absolute' => TRUE,
])
->toString();
$file_uri = $this->file
->createFileUrl(FALSE);
// Node relation to attached file.
$expected_value = [
'type' => 'uri',
'value' => $file_uri,
];
$this->assertTrue($this->hasRdfProperty($html, $this->baseUri, $node_uri, 'http://www.w3.org/2000/01/rdf-schema#seeAlso', $expected_value), 'Node to file relation found in RDF output (rdfs:seeAlso).');
$this->drupalGet('node');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.