You are here

public function FieldFormatterWithInlineSettingsTest::providerTestRender in (Entity Reference) Field Formatters 8

Same name and namespace in other branches
  1. 8.2 tests/src/Kernel/Plugin/Field/FieldFormatter/FieldFormatterWithInlineSettingsTest.php \Drupal\Tests\field_formatter\Kernel\Plugin\Field\FieldFormatter\FieldFormatterWithInlineSettingsTest::providerTestRender()
  2. 3.x tests/src/Kernel/Plugin/Field/FieldFormatter/FieldFormatterWithInlineSettingsTest.php \Drupal\Tests\field_formatter\Kernel\Plugin\Field\FieldFormatter\FieldFormatterWithInlineSettingsTest::providerTestRender()

Data provider for ::testRender().

File

tests/src/Kernel/Plugin/Field/FieldFormatter/FieldFormatterWithInlineSettingsTest.php, line 135

Class

FieldFormatterWithInlineSettingsTest
@coversDefaultClass \Drupal\field_formatter\Plugin\Field\FieldFormatter\FieldFormatterWithInlineSettings @group field_formatter

Namespace

Drupal\Tests\field_formatter\Kernel\Plugin\Field\FieldFormatter

Code

public function providerTestRender() {
  $output_with_label = <<<EXPECTED

  <div>
    <div>test_er_field</div>
              <div>
  <div>
    <div>Name</div>
              <div>child name</div>
          </div>
</div>
          </div>

EXPECTED;
  $output_without_label = <<<EXPECTED

  <div>
    <div>test_er_field</div>
              <div>
            <div>child name</div>
      </div>
          </div>

EXPECTED;
  $output_without_label_vh = <<<EXPECTED

  <div>
    <div>test_er_field</div>
              <div>
  <div>
    <div class="visually-hidden">Name</div>
              <div>child name</div>
          </div>
  </div>
          </div>

EXPECTED;
  return [
    [
      'above',
      $output_with_label,
    ],
    [
      'inline',
      $output_with_label,
    ],
    [
      'hidden',
      $output_without_label,
    ],
    [
      'visually_hidden',
      $output_without_label_vh,
    ],
  ];
}