public function CurrencyTest::testCurrencyImport in Commerce Core 8.2
Tests importing a currency.
File
- modules/
price/ tests/ src/ Functional/ CurrencyTest.php, line 28
Class
- CurrencyTest
- Tests the currency UI.
Namespace
Drupal\Tests\commerce_price\FunctionalCode
public function testCurrencyImport() {
$this
->drupalGet('admin/commerce/config/currencies/add');
$edit = [
'currency_codes[]' => [
'CHF',
],
];
$this
->submitForm($edit, 'Add');
$url = Url::fromRoute('entity.commerce_currency.collection');
$this
->assertEquals($this
->getUrl(), $this
->getAbsoluteUrl($url
->toString()));
$currency = Currency::load('CHF');
$this
->assertEquals('CHF', $currency
->getCurrencyCode());
$this
->assertEquals('Swiss Franc', $currency
->getName());
$this
->assertEquals('756', $currency
->getNumericCode());
$this
->assertEquals('CHF', $currency
->getSymbol());
$this
->assertEquals('2', $currency
->getFractionDigits());
}