protected function UbercartBrowserTestBase::checkout in Ubercart 8.4
Executes the checkout process.
Return value
\Drupal\uc_order\Entity\Order|false The created order, or FALSE if the order could not be created.
13 calls to UbercartBrowserTestBase::checkout()
- AttributeTest::testProductAttribute in uc_attribute/
tests/ src/ Functional/ AttributeTest.php - Tests attributes applied to a product.
- CartCheckoutTest::testAnonymousCheckoutAccountExists in uc_cart/
tests/ src/ Functional/ CartCheckoutTest.php - Tests associating an anonymous order with an existing account.
- CartCheckoutTest::testAnonymousCheckoutAccountGenerated in uc_cart/
tests/ src/ Functional/ CartCheckoutTest.php - Tests generating a user account upon anonymous checkout.
- CartCheckoutTest::testAnonymousCheckoutAccountProvided in uc_cart/
tests/ src/ Functional/ CartCheckoutTest.php - Tests anonymous checkout with an existing account.
- CartCheckoutTest::testAuthenticatedCheckout in uc_cart/
tests/ src/ Functional/ CartCheckoutTest.php - Tests authenticated user checkout.
File
- uc_store/
tests/ src/ Functional/ UbercartBrowserTestBase.php, line 171
Class
- UbercartBrowserTestBase
- Base class for Ubercart PHPUnit browser tests.
Namespace
Drupal\Tests\uc_store\FunctionalCode
protected function checkout(array $edit = []) {
/** @var \Drupal\Tests\WebAssert $assert */
$assert = $this
->assertSession();
$this
->drupalGet('cart');
$this
->submitForm([], 'Checkout');
// Check for billing pane text on cart page.
$assert
->pageTextContains('Enter your billing address and information here.');
$edit = $this
->populateCheckoutForm($edit);
// Submit the checkout page.
$this
->drupalGet('cart/checkout');
$this
->submitForm($edit, 'Review order');
$assert
->pageTextContains('Your order is almost complete.');
// Complete the review page.
$this
->submitForm([], 'Submit order');
$order_ids = \Drupal::entityQuery('uc_order')
->condition('billing_first_name', $edit['panes[billing][first_name]'])
->execute();
$order_id = reset($order_ids);
if ($order_id) {
$this
->assertTrue(TRUE, format_string('Order %order_id has been created', [
'%order_id' => $order_id,
]));
$order = Order::load($order_id);
}
else {
$this
->fail('No order was created.');
$order = FALSE;
}
return $order;
}