function EntityReferenceRdfaTest::testAllFormatters

Same name in other branches
  1. 9 core/modules/rdf/tests/src/Kernel/Field/EntityReferenceRdfaTest.php \Drupal\Tests\rdf\Kernel\Field\EntityReferenceRdfaTest::testAllFormatters()

Tests all the entity reference formatters.

File

core/modules/rdf/tests/src/Kernel/Field/EntityReferenceRdfaTest.php, line 86

Class

EntityReferenceRdfaTest
Tests the RDFa output of the entity reference field formatter.

Namespace

Drupal\Tests\rdf\Kernel\Field

Code

public function testAllFormatters() {
    $entity_uri = $this->getAbsoluteUri($this->targetEntity);
    // Tests the label formatter.
    $this->assertFormatterRdfa([
        'type' => 'entity_reference_label',
    ], 'http://schema.org/knows', [
        'value' => $entity_uri,
        'type' => 'uri',
    ]);
    // Tests the entity formatter.
    $this->assertFormatterRdfa([
        'type' => 'entity_reference_entity_view',
    ], 'http://schema.org/knows', [
        'value' => $entity_uri,
        'type' => 'uri',
    ]);
}

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