You are here

public function NumberFormatTest::testNumberFormatDefault in Tamper 8

Test zero decimal and thousands seperator with string.

File

tests/src/Unit/Plugin/Tamper/NumberFormatTest.php, line 25

Class

NumberFormatTest
Tests the number format plugin.

Namespace

Drupal\Tests\tamper\Unit\Plugin\Tamper

Code

public function testNumberFormatDefault() {
  $config = [
    NumberFormat::SETTING_DECIMALS => '0',
    NumberFormat::SETTING_DEC_POINT => '.',
    NumberFormat::SETTING_THOUSANDS_SEP => ',',
  ];
  $plugin = new NumberFormat($config, 'number_format', [], $this
    ->getMockSourceDefinition());
  $this
    ->assertEquals('1,235', $plugin
    ->tamper('1234.56'));
}