You are here

protected function CommerceBaseTestCase::setUpHelper in Commerce Core 7

Helper function to determine which modules should be enabled. Should be used in place of standard parent::setUp('moduleA', 'moduleB') call.

Parameters

$set: Which set of modules to load. Can be one of: 'all': (default) All Commerce modules, including UI and payment modules. 'ui': All API and UI modules. 'api': Just API modules (includes commerce_ui since checkout depends on it). 'dependencies': Common dependencies required by many Commerce API and UI modules.

$other_modules: Array of modules to include in addition to the sets loaded by $set

14 calls to CommerceBaseTestCase::setUpHelper()
CommerceBaseTesterTestCase::setUp in tests/commerce_base.test
setUp() performs any pre-requisite tasks that need to happen.
CommerceCartTestCase::setUpHelper in modules/cart/tests/commerce_cart.test
Helper function to perform the common test tasks for cart testing.
CommerceCheckoutTestProcess::setUp in modules/checkout/tests/commerce_checkout.test
Implementation of setUp().
CommerceCustomerUITest::setUp in modules/customer/tests/commerce_customer_ui.test
Implementation of setUp().
CommerceOrderCRUDTestCase::setUp in modules/order/tests/commerce_order.test
Sets up a Drupal site for running functional and integration tests.

... See full list

1 method overrides CommerceBaseTestCase::setUpHelper()
CommerceCartTestCase::setUpHelper in modules/cart/tests/commerce_cart.test
Helper function to perform the common test tasks for cart testing.

File

tests/commerce_base.test, line 30
Defines abstract base test class for the Commerce module tests.

Class

CommerceBaseTestCase
Abstract class for Commerce testing. All Commerce tests should extend this class.

Code

protected function setUpHelper($set = 'all', array $other_modules = array()) {
  $dependencies = array(
    // API
    'entity',
    'entity_token',
    'rules',
    'addressfield',
    //'rules_admin',

    // UI
    'ctools',
    'views',
    //'views_ui',
    'field',
    'field_ui',
    'field_sql_storage',
    'text',
    'list',
  );
  $api = array(
    'commerce',
    'commerce_product',
    'commerce_price',
    'commerce_customer',
    'commerce_line_item',
    'commerce_order',
    'commerce_product_reference',
    'commerce_payment',
    'commerce_tax',
    'commerce_product_pricing',
  );
  $ui = array(
    'commerce_ui',
    'commerce_checkout',
    'commerce_cart',
    'commerce_line_item_ui',
    'commerce_order_ui',
    'commerce_product_ui',
    'commerce_customer_ui',
    'commerce_payment_ui',
    'commerce_product_pricing_ui',
    'commerce_tax_ui',
  );
  $payment = array(
    'commerce_payment_example',
  );

  // Final module list
  $modules = array();

  // Cascade down the list and add sets
  switch ($set) {
    case 'all':
      $modules = array_merge($payment, $modules);
    case 'ui':
      $modules = array_merge($ui, $modules);
    case 'api':
      $modules = array_merge($api, $modules);
    case 'dependencies':
      $modules = array_merge($dependencies, $modules);
      break;
  }

  // Bring in modules specified by caller
  $modules = array_merge($modules, $other_modules);
  return $modules;
}