function TextFieldRdfaTest::testAllFormatters

Same name in other branches
  1. 9 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,
    ]);
}

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