You are here

function CommerceRecurringTestCase::testCommmerceRecurringRegularProduct in Commerce Recurring Framework 7.2

Test adding a regular product so it shouldn't recur.

File

tests/commerce_recurring.test, line 458
Unit tests for the commerce recurring module.

Class

CommerceRecurringTestCase
@file Unit tests for the commerce recurring module.

Code

function testCommmerceRecurringRegularProduct() {
  $this
    ->drupalLogin($this->customer);
  $order = $this
    ->createDummyOrder($this->customer->uid);
  $this
    ->drupalPost($this
    ->getCommerceUrl('cart'), array(), t('Checkout'));

  // Generate random information, as city, postal code, etc.
  $address_info = $this
    ->generateAddressInformation();

  // Fill in the billing address information.
  $billing_pane = $this
    ->xpath("//select[starts-with(@name, 'customer_profile_billing[commerce_customer_address]')]");
  $this
    ->drupalPostAJAX(NULL, array(
    (string) $billing_pane[0]['name'] => 'US',
  ), (string) $billing_pane[0]['name']);

  // Fill in the required information for billing pane, with a random State.
  $info = array(
    'customer_profile_billing[commerce_customer_address][und][0][name_line]' => $address_info['name_line'],
    'customer_profile_billing[commerce_customer_address][und][0][thoroughfare]' => $address_info['thoroughfare'],
    'customer_profile_billing[commerce_customer_address][und][0][locality]' => $address_info['locality'],
    'customer_profile_billing[commerce_customer_address][und][0][administrative_area]' => 'KY',
    'customer_profile_billing[commerce_customer_address][und][0][postal_code]' => $address_info['postal_code'],
  );
  $this
    ->drupalPost(NULL, $info, t('Continue to next step'));

  // Finish checkout process
  $this
    ->drupalPost(NULL, array(
    'commerce_payment[payment_method]' => 'commerce_payment_example|commerce_payment_commerce_payment_example',
  ), t('Continue to next step'));
  $orders = commerce_order_load_multiple(array(
    $order->order_id,
  ), array(), TRUE);
  $order = reset($orders);
  $this
    ->assertEqual(array(), commerce_recurring_load_by_order($order), t('No recurring entities associated with the order.'));
}