You are here

public function TextFieldRdfaTest::testAllFormatters in Zircon Profile 8

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

Tests all formatters.

@todo Check for the summary mapping.

File

core/modules/rdf/src/Tests/Field/TextFieldRdfaTest.php, line 64
Contains \Drupal\rdf\Tests\Field\TextFieldRdfaTest.

Class

TextFieldRdfaTest
Tests RDFa output by text field formatters.

Namespace

Drupal\rdf\Tests\Field

Code

public function testAllFormatters() {
  $formatted_value = strip_tags($this->entity->{$this->fieldName}->processed);

  // Tests the default formatter.
  $this
    ->assertFormatterRdfa(array(
    'type' => 'text_default',
  ), 'http://schema.org/text', array(
    'value' => $formatted_value,
  ));

  // Tests the summary formatter.
  $this
    ->assertFormatterRdfa(array(
    'type' => 'text_summary_or_trimmed',
  ), 'http://schema.org/text', array(
    'value' => $formatted_value,
  ));

  // Tests the trimmed formatter.
  $this
    ->assertFormatterRdfa(array(
    'type' => 'text_trimmed',
  ), 'http://schema.org/text', array(
    'value' => $formatted_value,
  ));
}