You are here

protected function CommerceTaxUIAdminTest::commerceTaxHelperCompleteCheckout in Commerce Core 7

Go through the checkout process.

2 calls to CommerceTaxUIAdminTest::commerceTaxHelperCompleteCheckout()
CommerceTaxUIAdminTest::testCommerceTaxUIAdminOrder in modules/tax/tests/commerce_tax_ui.test
Check the taxes applied in the order admin view.
CommerceTaxUIAdminTest::testCommerceTaxUIUserOrderView in modules/tax/tests/commerce_tax_ui.test
Check the taxes applied in the order that a normal user can view.

File

modules/tax/tests/commerce_tax_ui.test, line 51
Functional tests for the commerce tax UI module.

Class

CommerceTaxUIAdminTest
Functional tests for the commerce tax UI module.

Code

protected function commerceTaxHelperCompleteCheckout() {

  // 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'));
}