public function CommercePricelistTestCase::createDummyPricelistItem in Commerce Pricelist 7
Create a pricelist item for testing.
Parameters
array $vars:
Return value
mixed
3 calls to CommercePricelistTestCase::createDummyPricelistItem()
- CommercePricelistRoleTestCaseSimpleProduct::setUp in commerce_pricelist_role/
tests/ commerce_pricelist_role.test - Implementation of setUp().
- CommercePricelistTaxTest::testCommercePricelistTaxIncludedUserOrderView in tests/
commerce_pricelist_tax.test - Check the taxes applied in the order that a normal user can view.
- CommercePricelistTestCaseSimpleProduct::testCommercePricelistItemAdd in tests/
commerce_pricelist.test - Test if the price of a product changes when a price list item is added.
File
- tests/
commerce_pricelist.test, line 91 - 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
public function createDummyPricelistItem($vars = array()) {
$defaults = array(
'pricelist_id' => $this->pricelist_a->list_id,
'sku' => $this->product->sku,
'price_amount' => 100,
'currency_code' => 'USD',
);
$vars += $defaults;
$new_pricelist_item = entity_get_controller('commerce_pricelist_item')
->create();
foreach ($vars as $key => $value) {
$new_pricelist_item->{$key} = $value;
}
commerce_pricelist_item_save($new_pricelist_item);
return $new_pricelist_item;
}