You are here

function CommerceOrderUIAdminTest::setUp in Commerce Core 7

Implementation of setUp().

Overrides DrupalWebTestCase::setUp

File

modules/order/tests/commerce_order_ui.test, line 37
Functional tests for the commerce order UI module.

Class

CommerceOrderUIAdminTest
Functional tests for the commerce order UI module.

Code

function setUp() {
  $modules = parent::setUpHelper('all');
  parent::setUp($modules);

  // User creation for different operations.
  $this->store_admin = $this
    ->createStoreAdmin();
  $this->store_customer = $this
    ->createStoreCustomer();

  // Create dummy product.
  $this->product = $this
    ->createDummyProduct('PROD-01', 'Product One');

  // Log in as store admin.
  $this
    ->drupalLogin($this->store_admin);

  // Navigate to the order administration page.
  $this
    ->drupalGet('admin/commerce/orders/add');

  // Add a billing information profile to the order.
  $this
    ->drupalPostAJAX(NULL, array(), array(
    'op' => t('Add billing information'),
  ));

  // Fill in the billing address information
  $country_field = 'commerce_customer_billing[und][profiles][0][commerce_customer_address][und][0][country]';
  $this
    ->drupalPostAJAX(NULL, array(
    $country_field => 'US',
  ), $country_field);

  // Create the base order for the rest of tests. Assign it to the normal
  // user.
  $this
    ->drupalPost(NULL, array(
    'name' => $this->store_customer->name,
  ), t('Save order', array(), array(
    'context' => 'a drupal commerce order',
  )));

  // Load the order from database for later use.
  $orders = commerce_order_load_multiple(array(), array(
    'uid' => $this->store_customer->uid,
  ));
  $this->order = reset($orders);

  // Reset the cache as we don't want to keep the lock.
  entity_get_controller('commerce_order')
    ->resetCache();

  // Enable an additional currency.
  $this
    ->enableCurrencies(array(
    'EUR',
  ));
}