You are here

public function TextFieldRdfaTest::testAllFormatters in Drupal 8

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

Tests all formatters.

@todo Check for the summary mapping.

File

core/modules/rdf/tests/src/Kernel/Field/TextFieldRdfaTest.php, line 62

Class

TextFieldRdfaTest
Tests RDFa output by text field formatters.

Namespace

Drupal\Tests\rdf\Kernel\Field

Code

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

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

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

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