You are here

public function CommerceBaseTestCase::createDummyTaxType in Commerce Core 7

* Create a dummy tax type. * *

Parameters

$tax_type: * Array with the specific elements for the tax type, all the elements not * specified and required will be generated randomly. * @see hook_commerce_tax_type_info * * @return * The tax type array just created or FALSE if it wasn't created.

3 calls to CommerceBaseTestCase::createDummyTaxType()
CommerceBaseTesterTestCase::testTestCreateDummyTaxRate in tests/commerce_base.test
Test creating a new tax rate.
CommerceBaseTesterTestCase::testTestCreateDummyTaxType in tests/commerce_base.test
Test creating a new tax type.
CommerceTaxUIAdminTest::setUp in modules/tax/tests/commerce_tax_ui.test
Implementation of setUp().

File

tests/commerce_base.test, line 528
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

public function createDummyTaxType($tax_type = array()) {
  $defaults = array(
    'name' => 'example_tax_type',
    'title' => t('Example tax type'),
    'display_title' => t('Example tax type'),
    'description' => t('Example tax type for testing purposes'),
  );

  // Generate a tax type array based on defaults and specific elements.
  $tax_type = array_merge(commerce_tax_ui_tax_type_new(), $defaults, $tax_type);
  if (commerce_tax_ui_tax_type_save($tax_type)) {
    return commerce_tax_type_load($tax_type['name']);
  }
  else {
    return FALSE;
  }
}