You are here

public function DecimalSprintfFormatterTest::fieldFormatterDataProvider in Range 8

Specific formatter settings data provider.

Return value

array Nested arrays of values to check:

  • $settings
  • $from
  • $to
  • $expected_from
  • $expected_to

Overrides FormatterTestBase::fieldFormatterDataProvider

File

tests/src/Kernel/Formatter/DecimalSprintfFormatterTest.php, line 28

Class

DecimalSprintfFormatterTest
Tests the decimal formatter.

Namespace

Drupal\Tests\range\Kernel\Formatter

Code

public function fieldFormatterDataProvider() {
  return [
    // Test separate values.
    [
      [],
      1234.5678,
      7856.4321,
      '1234.57',
      '7856.43',
    ],
    [
      [
        'format_string' => '%d',
      ],
      1234.5678,
      7856.4321,
      '1234',
      '7856',
    ],
    // Test combined values.
    [
      [],
      1234.5678,
      1234.5678,
      '1234.57',
      '1234.57',
    ],
    [
      [
        'format_string' => '%.3e',
      ],
      1234.5678,
      1234.5678,
      '1.235e+3',
      '1.235e+3',
    ],
  ];
}