public function CurrencyTest::testCurrencyDeletion in Commerce Core 8.2
Tests deleting a currency via the admin.
File
- modules/
price/ tests/ src/ Functional/ CurrencyTest.php, line 97
Class
- CurrencyTest
- Tests the currency UI.
Namespace
Drupal\Tests\commerce_price\FunctionalCode
public function testCurrencyDeletion() {
$currency = $this
->createEntity('commerce_currency', [
'currencyCode' => 'XXX',
'name' => 'Test currency',
'numericCode' => 999,
'symbol' => '§',
'fractionDigits' => 2,
]);
$this
->drupalGet('admin/commerce/config/currencies/' . $currency
->id() . '/delete');
$this
->assertSession()
->pageTextContains(t("Are you sure you want to delete the currency @currency?", [
'@currency' => $currency
->getName(),
]));
$this
->assertSession()
->pageTextContains(t('This action cannot be undone.'));
$this
->submitForm([], 'Delete');
$currency_exists = (bool) Currency::load($currency
->id());
$this
->assertEmpty($currency_exists, 'The currency has been deleted from the database.');
}