protected function StandardProfileTest::doArticleRdfaTests in Drupal 10
Same name and namespace in other branches
- 8 core/modules/rdf/tests/src/Functional/StandardProfileTest.php \Drupal\Tests\rdf\Functional\StandardProfileTest::doArticleRdfaTests()
- 9 core/modules/rdf/tests/src/Functional/StandardProfileTest.php \Drupal\Tests\rdf\Functional\StandardProfileTest::doArticleRdfaTests()
Tests that article data is exposed using RDFa.
Two fields are not tested for output here. Changed date is not displayed on the page, so there is no test for output in node view. Comment count is displayed in teaser view, so it is tested in the front article tests.
File
- core/
modules/ rdf/ tests/ src/ Functional/ StandardProfileTest.php, line 288
Class
- StandardProfileTest
- Tests the RDF mappings and RDFa markup on top of the standard profile.
Namespace
Drupal\Tests\rdf\FunctionalCode
protected function doArticleRdfaTests() {
// Feed the HTML into the parser.
$this
->drupalGet($this->article
->toUrl());
// Type.
$this
->assertEquals('schema:Article', $this
->getElementRdfType($this->article
->toUrl(), $this->baseUri, $this->articleUri), 'Article type was found (schema:Article).');
// Test the properties that are common between pages and articles.
$this
->assertRdfaCommonNodeProperties($this->article, "Article");
// Test properties that are displayed in both teaser and full mode.
$this
->assertRdfaArticleProperties("Article");
// Test the comment properties displayed on articles.
$this
->assertRdfaNodeCommentProperties();
// @todo Once the image points to the original instead of the processed
// image, move this to testArticleProperties().
$expected_value = [
'type' => 'uri',
'value' => $this->imageUri,
];
$this
->assertTrue($this
->hasRdfProperty($this
->getSession()
->getPage()
->getContent(), $this->baseUri, $this->articleUri, 'http://schema.org/image', $expected_value), 'Teaser image was found (schema:image).');
}