You are here

function UcAddressesCartCheckoutTestCase::checkout in Ubercart Addresses 6.2

Same name and namespace in other branches
  1. 7 tests/uc_addresses.checkout.test \UcAddressesCartCheckoutTestCase::checkout()

Override of UbercartTestHelper::checkout().

Return value

object An Ubercart order object, if checkout succeeded. False otherwise.

Overrides UbercartTestHelper::checkout

1 call to UcAddressesCartCheckoutTestCase::checkout()
UcAddressesCartCheckoutTestCase::testDoubleAddresses in tests/uc_addresses.checkout.test
Test if double addresses are not saved when checking out.

File

tests/uc_addresses.checkout.test, line 55
Test cases for checkout.

Class

UcAddressesCartCheckoutTestCase
Test cases for checkout.

Code

function checkout($edit = array()) {
  $this
    ->drupalPost('cart', array(), 'Checkout');

  // Build the panes.
  $edit += $this
    ->populateCheckoutForm();

  // 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_result(db_query("SELECT order_id FROM {uc_orders} WHERE delivery_first_name = '%s'", $edit['panes[delivery][delivery][delivery_first_name]']));
  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('An order was created.'));
    $order = FALSE;
  }
  return $order;
}