You are here

protected function CommercePricelistTestCase::commercePricelistHelperCompleteCheckout in Commerce Pricelist 7

Go through the checkout process.

1 call to CommercePricelistTestCase::commercePricelistHelperCompleteCheckout()
CommercePricelistTaxTest::testCommercePricelistTaxIncludedUserOrderView in tests/commerce_pricelist_tax.test
Check the taxes applied in the order that a normal user can view.

File

tests/commerce_pricelist.test, line 129
Functional tests for the commerce price list module.

Class

CommercePricelistTestCase
Abstract class for Commerce price list testing. All Commerce price list tests should extend this class.

Code

protected function commercePricelistHelperCompleteCheckout() {

  // Get the checkout url and navigate to it.
  $links = commerce_line_item_summary_links();
  $this->checkout_url = $links['checkout']['href'];
  $this
    ->drupalGet($this->checkout_url);

  // The rule that sends a mail after checkout completion should be disabled
  //  as it returns an error caused by how mail messages are stored.
  $rules_config = rules_config_load('commerce_checkout_order_email');
  $rules_config->active = FALSE;
  $rules_config
    ->save();

  // Complete the order process.
  $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']);
  $info = array(
    'customer_profile_billing[commerce_customer_address][und][0][name_line]' => $this
      ->randomName(),
    'customer_profile_billing[commerce_customer_address][und][0][thoroughfare]' => $this
      ->randomName(),
    'customer_profile_billing[commerce_customer_address][und][0][locality]' => $this
      ->randomName(),
    'customer_profile_billing[commerce_customer_address][und][0][administrative_area]' => 'KY',
    'customer_profile_billing[commerce_customer_address][und][0][postal_code]' => rand(00, 99999),
  );
  $this
    ->drupalPost(NULL, $info, t('Continue to next step'));
  $this
    ->drupalPost(NULL, array(), t('Continue to next step'));
}