You are here

public function CheckoutFlowTest::testCheckoutFlowCreation in Commerce Core 8.2

Tests creating a checkout flow.

File

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

Class

CheckoutFlowTest
Tests the checkout flow UI.

Namespace

Drupal\Tests\commerce_checkout\Functional

Code

public function testCheckoutFlowCreation() {
  $this
    ->drupalGet('admin/commerce/config/checkout-flows');
  $this
    ->getSession()
    ->getPage()
    ->clickLink('Add checkout flow');
  $edit = [
    'label' => 'Test checkout flow',
    'id' => 'test_checkout_flow',
    'plugin' => 'multistep_default',
  ];
  $this
    ->submitForm($edit, 'Save');
  $this
    ->assertSession()
    ->pageTextContains(t('Saved the @name checkout flow.', [
    '@name' => $edit['label'],
  ]));
  $checkout_flow = CheckoutFlow::load('test_checkout_flow');
  $this
    ->assertEquals('Test checkout flow', $checkout_flow
    ->label());
  $this
    ->assertEquals('multistep_default', $checkout_flow
    ->getPluginId());
}