You are here

public function CartCheckoutTest::testAnonymousCheckoutAccountExists in Ubercart 8.4

Tests associating an anonymous order with an existing account.

File

uc_cart/tests/src/Functional/CartCheckoutTest.php, line 413

Class

CartCheckoutTest
Tests the cart and checkout functionality.

Namespace

Drupal\Tests\uc_cart\Functional

Code

public function testAnonymousCheckoutAccountExists() {

  /** @var \Drupal\Tests\WebAssert $assert */
  $assert = $this
    ->assertSession();
  $this
    ->addToCart($this->product);
  $this
    ->checkout([
    'panes[customer][primary_email]' => $this->customer
      ->getEmail(),
  ]);
  $assert
    ->responseContains('Your order is complete!');
  $assert
    ->responseContains('order has been attached to the account we found');

  // Check that cart is now empty.
  $this
    ->drupalGet('cart');
  $assert
    ->pageTextContains('There are no products in your shopping cart.');
}