function UbercartTestHelper::createProduct in Ubercart 6.2
Same name and namespace in other branches
- 7.3 uc_store/tests/uc_store.test \UbercartTestHelper::createProduct()
Creates a new product.
11 calls to UbercartTestHelper::createProduct()
- UbercartAttributeTestCase::testAttributeAPI in uc_attribute/
uc_attribute.test - Tests the basic attribute API.
- UbercartAttributeTestCase::testAttributeUIAttributeOptionsBulkEdit in uc_attribute/
uc_attribute.test - Tests the "bulk edit attribute options" user interface.
- UbercartAttributeTestCase::testAttributeUIProductAttributeBulkUpdate in uc_attribute/
uc_attribute.test - Tests the bulk product attribute update user interface.
- UbercartAttributeTestCase::testAttributeUIProductAttributeOverview in uc_attribute/
uc_attribute.test - Tests the product node attribute user interface.
- UbercartAttributeTestCase::testAttributeUISettings in uc_attribute/
uc_attribute.test - Tests the attribute settings page.
File
- uc_store/
uc_store.test, line 63 - Test functionality provided by uc_store.
Class
- UbercartTestHelper
- Defines a base helper class for Ubercart tests.
Code
function createProduct($product = array()) {
// Set the default required fields.
$weight_units = array(
'lb',
'kg',
'oz',
'g',
);
$length_units = array(
'in',
'ft',
'cm',
'mm',
);
$product += array(
'type' => 'product',
'model' => $this
->randomName(8),
'list_price' => mt_rand(1, 9999),
'cost' => mt_rand(1, 9999),
'sell_price' => mt_rand(1, 9999),
'weight' => mt_rand(1, 9999),
'weight_units' => array_rand(array_flip($weight_units)),
'length' => mt_rand(1, 9999),
'width' => mt_rand(1, 9999),
'height' => mt_rand(1, 9999),
'length_units' => array_rand(array_flip($length_units)),
'pkg_qty' => mt_rand(1, 99),
'default_qty' => 1,
'ordering' => mt_rand(-25, 25),
'shippable' => TRUE,
);
return $this
->drupalCreateNode($product);
}