public static function UbercartAttributeTestCase::createAttribute in Ubercart 6.2
Same name and namespace in other branches
- 7.3 uc_attribute/tests/uc_attribute.test \UbercartAttributeTestCase::createAttribute()
Tests the product class attribute option user interface.
16 calls to UbercartAttributeTestCase::createAttribute()
- UbercartAttributeTestCase::testAttributeAPI in uc_attribute/
uc_attribute.test - Tests the basic attribute API.
- UbercartAttributeTestCase::testAttributeUIAddAttribute in uc_attribute/
uc_attribute.test - Tests the "add attribute" user interface.
- 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.
File
- uc_attribute/
uc_attribute.test, line 821 - Ubercart Attribute Tests
Class
- UbercartAttributeTestCase
- SimpleTests for the Ubercart Attributes API.
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;
}