You are here

function UcAddressesCartCheckoutTestCase::testAnonymousCheckoutWithoutMailAddress in Ubercart Addresses 7

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

Tests if a customer can checkout when not providing a mail address.

File

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

Class

UcAddressesCartCheckoutTestCase
Test cases for checkout.

Code

function testAnonymousCheckoutWithoutMailAddress() {

  // Disable the Customer information pane.
  variable_set('uc_pane_customer_enabled', FALSE);

  // Place item in cart.
  $this
    ->drupalPost('node/' . $this->product->nid, array(), t('Add to cart'));

  // Continue to checkout.
  $this
    ->drupalPost('cart', array(), 'Checkout');

  // Populate checkout form, but omit filling mail address.
  $edit = $this
    ->populateCheckoutForm();
  unset($edit['panes[customer][primary_email]']);

  // And checkout.
  $this
    ->drupalPost(NULL, $edit, t('Review order'));
  $this
    ->assertRaw(t('Your order is almost complete.'));
  $this
    ->drupalPost(NULL, array(), t('Submit order'));

  // Check if an order has been created.
  $conditions = array(
    'delivery_first_name' => $edit['panes[delivery][address][delivery_first_name]'],
  );
  return $this
    ->checkExistingOrder($conditions);
}