You are here

public function NumberElementTest::testLocalFormat in Commerce Core 8.2

Tests the element with a non-English number format.

File

modules/price/tests/src/Functional/NumberElementTest.php, line 64

Class

NumberElementTest
Tests the number element.

Namespace

Drupal\Tests\commerce_price\Functional

Code

public function testLocalFormat() {

  // French uses a comma as a decimal separator.
  ConfigurableLanguage::createFromLangcode('fr')
    ->save();
  $this
    ->config('system.site')
    ->set('default_langcode', 'fr')
    ->save();
  $this
    ->drupalGet('/commerce_price_test/number_test_form');
  $this
    ->assertSession()
    ->fieldExists('number');

  // Default value.
  $this
    ->assertSession()
    ->fieldValueEquals('number', '99,99');

  // Valid submit.
  $edit = [
    'number' => '10,99',
  ];
  $this
    ->submitForm($edit, 'Submit');
  $this
    ->assertSession()
    ->pageTextContains('The number is "10.99".');
}