public function CommerceExchangerTest::testCommerceExchangerDeletion in Commerce Exchanger 8
Tests deleting a exchange rate.
File
- tests/
src/ FunctionalJavascript/ CommerceExchangerTest.php, line 166
Class
- CommerceExchangerTest
- Tests the commerce exchanger UI.
Namespace
Drupal\Tests\commerce_exchanger\FunctionalJavascriptCode
public function testCommerceExchangerDeletion() {
$exchange_rates = $this
->createEntity('commerce_exchange_rates', [
'label' => 'ECB',
'id' => 'ecb',
'plugin' => 'ecb',
]);
$config_rates = $exchange_rates
->getExchangerConfigName();
$entity_id = $exchange_rates
->id();
$this
->drupalGet('admin/commerce/config/exchange-rates/' . $entity_id . '/delete');
$this
->assertSession()
->pageTextContains(t('Are you sure you want to delete the exchange rates @exchange_rate?', [
'@exchange_rate' => $exchange_rates
->label(),
]));
$this
->assertSession()
->pageTextContains(t('This action cannot be undone.'));
$this
->submitForm([], 'Delete');
$exchange_rates_exists = (bool) ExchangeRates::load($entity_id);
$this
->assertEmpty($exchange_rates_exists, 'The exchange rates has been deleted from the database.');
$exchange_rates_config = $this
->config($config_rates)
->getRawData();
$this
->assertEmpty($exchange_rates_config, 'The exchange rates configuration file has been deleted.');
$this
->assertSession()
->pageTextContains(t('There are no exchange rates entities yet.'));
}