You are here

public function CheckoutFlowTest::testCheckoutFlowDeletion in Commerce Core 8.2

Tests deleting a checkout flow via the admin.

File

modules/checkout/tests/src/Functional/CheckoutFlowTest.php, line 80

Class

CheckoutFlowTest
Tests the checkout flow UI.

Namespace

Drupal\Tests\commerce_checkout\Functional

Code

public function testCheckoutFlowDeletion() {
  $checkout_flow = $this
    ->createEntity('commerce_checkout_flow', [
    'label' => 'Test checkout flow',
    'id' => 'test_checkout_flow',
    'plugin' => 'multistep_default',
  ]);
  $this
    ->drupalGet('admin/commerce/config/checkout-flows/manage/' . $checkout_flow
    ->id() . '/delete');
  $this
    ->assertSession()
    ->pageTextContains(t("Are you sure you want to delete the checkout flow @flow?", [
    '@flow' => $checkout_flow
      ->label(),
  ]));
  $this
    ->assertSession()
    ->pageTextContains(t('This action cannot be undone.'));
  $this
    ->submitForm([], 'Delete');
  $checkout_flow_exists = (bool) CheckoutFlow::load($checkout_flow
    ->id());
  $this
    ->assertEmpty($checkout_flow_exists, 'The checkout flow has been deleted from the database.');
}