public static function UbercartAttributeTestCase::createAttributeOption in Ubercart 6.2
Same name and namespace in other branches
- 7.3 uc_attribute/tests/uc_attribute.test \UbercartAttributeTestCase::createAttributeOption()
Creates an attribute option.
Parameters
$data:
$save:
9 calls to UbercartAttributeTestCase::createAttributeOption()
- UbercartAttributeTestCase::testAttributeAPI in uc_attribute/
uc_attribute.test - Tests the basic attribute API.
- UbercartAttributeTestCase::testAttributeUIAttributeOptions in uc_attribute/
uc_attribute.test - Tests the attribute options user interface.
- UbercartAttributeTestCase::testAttributeUIAttributeOptionsAdd in uc_attribute/
uc_attribute.test - Tests the "add attribute option" user interface.
- UbercartAttributeTestCase::testAttributeUIAttributeOptionsBulkEdit in uc_attribute/
uc_attribute.test - Tests the "bulk edit attribute options" user interface.
- UbercartAttributeTestCase::testAttributeUIAttributeOptionsDelete in uc_attribute/
uc_attribute.test - Tests the "delete attribute option" user interface.
File
- uc_attribute/
uc_attribute.test, line 844 - Ubercart Attribute Tests
Class
- UbercartAttributeTestCase
- SimpleTests for the Ubercart Attributes API.
Code
public static function createAttributeOption($data = array(), $save = TRUE) {
$option = $data + array(
'name' => DrupalWebTestCase::randomName(8),
'cost' => mt_rand(-500, 500),
'price' => mt_rand(-500, 500),
'weight' => mt_rand(-500, 500),
'ordering' => mt_rand(-10, 10),
);
$option = (object) $option;
if ($save) {
uc_attribute_option_save($option);
}
return $option;
}