You are here

function UcAddressesCartCheckoutTestCase::checkExistingOrder in Ubercart Addresses 7

Checks if an order has been created based on given conditions.

Parameters

array $conditions: The conditions to check against.

Return value

object An Ubercart order object, if found. False otherwise.

3 calls to UcAddressesCartCheckoutTestCase::checkExistingOrder()
UcAddressesCartCheckoutTestCase::checkout in tests/uc_addresses.checkout.test
Override of UbercartTestHelper::checkout().
UcAddressesCartCheckoutTestCase::testAnonymousCheckoutWithoutMailAddress in tests/uc_addresses.checkout.test
Tests if a customer can checkout when not providing a mail address.
UcAddressesCartCheckoutTestCase::testCheckoutSameAddress in tests/uc_addresses.checkout.test
Test a checkout with the "Use the same address" setting.

File

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

Class

UcAddressesCartCheckoutTestCase
Test cases for checkout.

Code

function checkExistingOrder($conditions) {
  $query = db_select('uc_orders');
  $query
    ->fields('uc_orders', array(
    'order_id',
  ));
  foreach ($conditions as $field => $value) {
    $query
      ->condition($field, $value);
  }
  $order_id = $query
    ->execute()
    ->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('An order was created.'));
    $order = FALSE;
  }
  return $order;
}