public function CartCheckoutTest::testCheckoutLogin in Ubercart 8.4
Tests logging in the customer after checkout.
File
- uc_cart/
tests/ src/ Functional/ CartCheckoutTest.php, line 500
Class
- CartCheckoutTest
- Tests the cart and checkout functionality.
Namespace
Drupal\Tests\uc_cart\FunctionalCode
public function testCheckoutLogin() {
/** @var \Drupal\Tests\WebAssert $assert */
$assert = $this
->assertSession();
// Log in after checkout.
$settings = [
'uc_new_customer_login' => TRUE,
];
$this
->drupalLogin($this->adminUser);
$this
->drupalGet('admin/store/config/checkout');
$this
->submitForm($settings, 'Save configuration');
$this
->drupalLogout();
// Test checkout.
$this
->addToCart($this->product);
$this
->checkout();
$assert
->responseContains('Your order is complete!');
$assert
->responseContains('you are already logged in');
// Confirm login.
$this
->drupalGet('<front>');
$assert
->pageTextContains('Member for ', 'User is logged in.');
// Check that cart is now empty.
$this
->drupalGet('cart');
$assert
->pageTextContains('There are no products in your shopping cart.');
}