public function UbercartAttributeTestCase::testAttributeUIEditAttribute in Ubercart 6.2
Same name and namespace in other branches
- 7.3 uc_attribute/tests/uc_attribute.test \UbercartAttributeTestCase::testAttributeUIEditAttribute()
Tests the "edit attribute" user interface.
File
- uc_attribute/
uc_attribute.test, line 421 - Ubercart Attribute Tests
Class
- UbercartAttributeTestCase
- SimpleTests for the Ubercart Attributes API.
Code
public function testAttributeUIEditAttribute() {
$attribute = self::createAttribute();
$this
->drupalGet('admin/store/attributes/' . $attribute->aid . '/edit');
$this
->AssertText(t('Edit attribute: @name', array(
'@name' => $attribute->name,
)), t('Attribute edit form working.'), t('Ubercart'));
$edit = (array) self::createAttribute(array(), FALSE);
$this
->drupalPost('admin/store/attributes/' . $attribute->aid . '/edit', $edit, t('Submit'));
$attribute = uc_attribute_load($attribute->aid);
$fields_ok = TRUE;
foreach ($edit as $field => $value) {
if ($attribute->{$field} != $value) {
$this
->showVar($attribute);
$this
->showVar($edit);
$fields_ok = FALSE;
break;
}
}
$this
->AssertTrue($fields_ok, t('Attribute edited properly.'), t('Ubercart'));
}