You are here

protected function FormatterTestBase::formatterDataProvider in Range 8

Formatter settings data provider.

Return value

array Nested arrays of values to check:

  • $display_settings
  • $from
  • $to
  • $expected
1 call to FormatterTestBase::formatterDataProvider()
FormatterTestBase::testFieldFormatter in tests/src/Kernel/Formatter/FormatterTestBase.php
Tests formatter.

File

tests/src/Kernel/Formatter/FormatterTestBase.php, line 120

Class

FormatterTestBase
Base class for range functional integration tests.

Namespace

Drupal\Tests\range\Kernel\Formatter

Code

protected function formatterDataProvider() {

  // Loop over the specific formatter settings.
  foreach ($this
    ->fieldFormatterDataProvider() as list($settings, $from, $to, $expected_from, $expected_to)) {

    // Loop over the base formatter settings.
    foreach ($this
      ->fieldFormatterBaseDataProvider() as list($base_settings, $expected_format_separate, $expected_format_combined)) {
      $diplay_settings = $settings + $base_settings + $this->defaultSettings;
      $expected_format = $expected_from !== $expected_to ? $expected_format_separate : $expected_format_combined;
      (yield [
        $diplay_settings,
        $from,
        $to,
        sprintf($expected_format, $expected_from, $expected_to),
      ]);
    }
  }
}