public function CartCheckoutTest::testAuthenticatedCheckout in Ubercart 8.4
Tests authenticated user checkout.
File
- uc_cart/
tests/ src/ Functional/ CartCheckoutTest.php, line 297
Class
- CartCheckoutTest
- Tests the cart and checkout functionality.
Namespace
Drupal\Tests\uc_cart\FunctionalCode
public function testAuthenticatedCheckout() {
/** @var \Drupal\Tests\WebAssert $assert */
$assert = $this
->assertSession();
$this
->drupalLogin($this->customer);
$this
->addToCart($this->product);
$order = $this
->checkout();
$assert
->responseContains('Your order is complete!');
$assert
->responseContains('While logged in');
$this
->assertEquals($this->customer
->id(), $order
->getOwnerId(), 'Order has the correct user ID.');
$this
->assertEquals($this->customer
->getEmail(), $order
->getEmail(), 'Order has the correct email address.');
// Check that cart is now empty.
$this
->drupalGet('cart');
$assert
->pageTextContains('There are no products in your shopping cart.');
}