function StandardProfileTest::assertRdfaArticleProperties

Same name and namespace in other branches
  1. 8.9.x core/modules/rdf/tests/src/Functional/StandardProfileTest.php \Drupal\Tests\rdf\Functional\StandardProfileTest::assertRdfaArticleProperties()

Tests output for article properties displayed in both view modes.

@internal

Parameters

string $message_prefix: The word to use in the test assertion message.

2 calls to StandardProfileTest::assertRdfaArticleProperties()
StandardProfileTest::doArticleRdfaTests in core/modules/rdf/tests/src/Functional/StandardProfileTest.php
Tests that article data is exposed using RDFa.
StandardProfileTest::doFrontPageRdfaTests in core/modules/rdf/tests/src/Functional/StandardProfileTest.php
Tests that data is exposed in the front page teasers.

File

core/modules/rdf/tests/src/Functional/StandardProfileTest.php, line 439

Class

StandardProfileTest
Tests the RDF mappings and RDFa markup on top of the standard profile.

Namespace

Drupal\Tests\rdf\Functional

Code

protected function assertRdfaArticleProperties(string $message_prefix) : void {
    // Tags.
    $expected_value = [
        'type' => 'uri',
        'value' => $this->termUri,
    ];
    $this->assertTrue($this->hasRdfProperty($this->getSession()
        ->getPage()
        ->getContent(), $this->baseUri, $this->articleUri, 'http://schema.org/about', $expected_value), "{$message_prefix} tag was found (schema:about).");
    // Tag type.
    // @todo Enable with https://www.drupal.org/node/2072791.
    // $this->assertEquals('schema:Thing', $graph->type($this->termUri), 'Tag type was found (schema:Thing).');
    // Tag name.
    $expected_value = [
        'type' => 'literal',
        'value' => $this->term
            ->getName(),
        'lang' => 'en',
    ];
    // @todo Enable with https://www.drupal.org/node/2072791.
    // $this->assertTrue($graph->hasProperty($this->termUri, 'http://schema.org/name', $expected_value), "$message_prefix name was found (schema:name).");
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.