You are here

protected function UbercartTestHelper::checkout in Ubercart 7.3

Same name and namespace in other branches
  1. 6.2 uc_store/uc_store.test \UbercartTestHelper::checkout()

Executes the checkout process.

10 calls to UbercartTestHelper::checkout()
UbercartAttributeTestCase::testProductAttribute in uc_attribute/tests/uc_attribute.test
Tests attributes applied to a product.
UbercartCartCheckoutTestCase::testCheckout in uc_cart/tests/uc_cart.test
Tests the checkout process.
UbercartCartCheckoutTestCase::testCheckoutBlockedUser in uc_cart/tests/uc_cart.test
Tests blocked user checkout.
UbercartCartCheckoutTestCase::testCheckoutLogin in uc_cart/tests/uc_cart.test
Tests logging in the customer after checkout.
UbercartCreditCardTestCase::testCheckout in payment/uc_credit/tests/uc_credit.test
Tests that an order can be placed using the test gateway.

... See full list

File

uc_store/tests/uc_store.test, line 141
Test functionality provided by uc_store.

Class

UbercartTestHelper
Defines a base helper class for Ubercart tests.

Code

protected function checkout($edit = array()) {
  $this
    ->drupalPost('cart', array(), 'Checkout');
  $this
    ->assertText(t('Enter your billing address and information here.'), t('Viewed cart page: Billing pane has been displayed.'));
  $edit = $this
    ->populateCheckoutForm($edit);

  // Submit the checkout page.
  $this
    ->drupalPost('cart/checkout', $edit, t('Review order'));
  $this
    ->assertRaw(t('Your order is almost complete.'));

  // Complete the review page.
  $this
    ->drupalPost(NULL, array(), t('Submit order'));
  $order_id = db_query("SELECT order_id FROM {uc_orders} WHERE delivery_first_name = :name", array(
    ':name' => $edit['panes[delivery][delivery_first_name]'],
  ))
    ->fetchField();
  if ($order_id) {
    $this
      ->pass(t('Order %order_id has been created', array(
      '%order_id' => $order_id,
    )));
    $order = uc_order_load($order_id);
  }
  else {
    $this
      ->fail(t('No order was created.'));
    $order = FALSE;
  }
  return $order;
}