You are here

public function DecimalFormatterTest::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/DecimalFormatterTest.php, line 28

Class

DecimalFormatterTest
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',
    ],
    [
      [
        'scale' => 3,
        'thousand_separator' => ' ',
        'decimal_separator' => ',',
      ],
      1234.5678,
      7856.4321,
      '1 234,568',
      '7 856,432',
    ],
    // Test combined values.
    [
      [],
      1234.5678,
      1234.5678,
      '1234.57',
      '1234.57',
    ],
    [
      [
        'scale' => 3,
        'thousand_separator' => ' ',
        'decimal_separator' => ',',
      ],
      1234.5678,
      1234.5678,
      '1 234,568',
      '1 234,568',
    ],
  ];
}