View source
<?php
namespace Drupal\Tests\range\Kernel\Formatter;
use Drupal\range\Plugin\Field\FieldFormatter\RangeDecimalFormatter;
class DecimalFormatterTest extends FormatterTestBase {
protected function setUp() : void {
$this->fieldType = 'range_float';
$this->displayType = 'range_decimal';
$this->defaultSettings = RangeDecimalFormatter::defaultSettings();
parent::setUp();
}
public function fieldFormatterDataProvider() {
return [
[
[],
1234.5678,
7856.4321,
'1234.57',
'7856.43',
],
[
[
'scale' => 3,
'thousand_separator' => ' ',
'decimal_separator' => ',',
],
1234.5678,
7856.4321,
'1 234,568',
'7 856,432',
],
[
[],
1234.5678,
1234.5678,
'1234.57',
'1234.57',
],
[
[
'scale' => 3,
'thousand_separator' => ' ',
'decimal_separator' => ',',
],
1234.5678,
1234.5678,
'1 234,568',
'1 234,568',
],
];
}
}