You are here

public function EntityReferenceRdfaTest::testAllFormatters in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/rdf/tests/src/Kernel/Field/EntityReferenceRdfaTest.php \Drupal\Tests\rdf\Kernel\Field\EntityReferenceRdfaTest::testAllFormatters()
  2. 10 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',
  ]);
}