You are here

public function ChainCheckoutFlowResolverTest::testCheckoutFlowResolution in Commerce Core 8.2

Tests resolving the checkout flow.

File

modules/checkout/tests/src/Kernel/ChainCheckoutFlowResolverTest.php, line 36

Class

ChainCheckoutFlowResolverTest
Tests the chain checkout flow resolver.

Namespace

Drupal\Tests\commerce_checkout\Kernel

Code

public function testCheckoutFlowResolution() {
  $user = $this
    ->createUser([
    'mail' => $this
      ->randomString() . '@example.com',
  ]);
  $order = Order::create([
    'type' => 'default',
    'mail' => $user
      ->getEmail(),
    'uid' => $user
      ->id(),
    'store_id' => $this->store
      ->id(),
  ]);
  $order
    ->save();
  $resolver = $this->container
    ->get('commerce_checkout.chain_checkout_flow_resolver');

  /** @var \Drupal\commerce_checkout\Entity\CheckoutFlowInterface $checkout_flow */
  $checkout_flow = $resolver
    ->resolve($order);
  $this
    ->assertEquals('default', $checkout_flow
    ->id());
}