public static function DropdownAttributeTestCase::createAttribute in Dropdown Attributes 6
Tests the product class attribute option user interface.
2 calls to DropdownAttributeTestCase::createAttribute()
- DropdownAttributeTestCase::testClassAttributeDependency in tests/
uc_dropdown_attributes.test - Tests for dropdown attributes in product classes.
- DropdownAttributeTestCase::testProductAttributeDependency in tests/
uc_dropdown_attributes.test - Tests for dropdown attributes in products.
File
- tests/
uc_dropdown_attributes.test, line 186 - Dropdown Attribute Tests
Class
- DropdownAttributeTestCase
- Tests for Dropdown Attributes.
Code
public static function createAttribute($data = array(), $save = TRUE) {
$attribute = $data + array(
'name' => DrupalWebTestCase::randomName(8),
'label' => DrupalWebTestCase::randomName(8),
'description' => DrupalWebTestCase::randomName(8),
'required' => mt_rand(0, 1) ? TRUE : FALSE,
'display' => mt_rand(0, 3),
'ordering' => mt_rand(-10, 10),
);
$attribute = (object) $attribute;
if ($save) {
uc_attribute_save($attribute);
}
return $attribute;
}