You are here

public function EntityReferenceRdfaTest::testAllFormatters in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/rdf/src/Tests/Field/EntityReferenceRdfaTest.php \Drupal\rdf\Tests\Field\EntityReferenceRdfaTest::testAllFormatters()

Tests all the entity reference formatters.

File

core/modules/rdf/src/Tests/Field/EntityReferenceRdfaTest.php, line 86
Contains \Drupal\rdf\Tests\Field\EntityReferenceRdfaTest.

Class

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

Namespace

Drupal\rdf\Tests\Field

Code

public function testAllFormatters() {
  $entity_uri = $this
    ->getAbsoluteUri($this->targetEntity);

  // Tests the label formatter.
  $this
    ->assertFormatterRdfa(array(
    'type' => 'entity_reference_label',
  ), 'http://schema.org/knows', array(
    'value' => $entity_uri,
    'type' => 'uri',
  ));

  // Tests the entity formatter.
  $this
    ->assertFormatterRdfa(array(
    'type' => 'entity_reference_entity_view',
  ), 'http://schema.org/knows', array(
    'value' => $entity_uri,
    'type' => 'uri',
  ));
}