protected function StandardProfileTest::doFrontPageRdfaTests in Drupal 9
Same name and namespace in other branches
- 8 core/modules/rdf/tests/src/Functional/StandardProfileTest.php \Drupal\Tests\rdf\Functional\StandardProfileTest::doFrontPageRdfaTests()
- 10 core/modules/rdf/tests/src/Functional/StandardProfileTest.php \Drupal\Tests\rdf\Functional\StandardProfileTest::doFrontPageRdfaTests()
Tests that data is exposed in the front page teasers.
1 call to StandardProfileTest::doFrontPageRdfaTests()
- StandardProfileTest::testRdfaOutput in core/
modules/ rdf/ tests/ src/ Functional/ StandardProfileTest.php - Tests that data is exposed correctly when using standard profile.
File
- core/
modules/ rdf/ tests/ src/ Functional/ StandardProfileTest.php, line 210
Class
- StandardProfileTest
- Tests the RDF mappings and RDFa markup of the standard profile.
Namespace
Drupal\Tests\rdf\FunctionalCode
protected function doFrontPageRdfaTests() {
// Feed the HTML into the parser.
$this
->drupalGet(Url::fromRoute('<front>'));
// Ensure that both articles are listed.
// $this->assertCount(2, $this->getRdfGraph(Url::fromRoute('<front>'), $this->baseUri)->allOfType('http://schema.org/Article'), 'Two articles found on front page.');
$this
->assertEquals(2, $this
->getElementByRdfTypeCount(Url::fromRoute('<front>'), $this->baseUri, 'http://schema.org/Article'), 'Two articles found on front page.');
// Test interaction count.
$expected_value = [
'type' => 'literal',
'value' => 'UserComments:1',
'lang' => 'en',
];
$this
->assertTrue($this
->hasRdfProperty($this
->getSession()
->getPage()
->getContent(), $this->baseUri, $this->articleUri, 'http://schema.org/interactionCount', $expected_value), 'Teaser comment count was found (schema:interactionCount).');
// Test the properties that are common between pages and articles and are
// displayed in full and teaser mode.
$this
->assertRdfaCommonNodeProperties($this->article, "Teaser");
// Test properties that are displayed in both teaser and full mode.
$this
->assertRdfaArticleProperties("Teaser");
// @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).');
}