function StandardProfileTest::doTermRdfaTests

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

Tests that term data is exposed on term page.

1 call to StandardProfileTest::doTermRdfaTests()
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 357

Class

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

Namespace

Drupal\Tests\rdf\Functional

Code

protected function doTermRdfaTests() {
    // Term type.
    $this->assertEquals('schema:Thing', $this->getElementRdfType($this->term
        ->toUrl(), $this->baseUri, $this->termUri), 'Term type was found (schema:Thing) on term page.');
    // Term name.
    $expected_value = [
        'type' => 'literal',
        'value' => $this->term
            ->getName(),
        'lang' => 'en',
    ];
    $this->assertTrue($this->hasRdfProperty($this->getSession()
        ->getPage()
        ->getContent(), $this->baseUri, $this->termUri, 'http://schema.org/name', $expected_value), 'Term name was found (schema:name) on term page.');
    // @todo Add test for term description once it is a field:
    //   https://www.drupal.org/node/569434.
}

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