public function UbercartAttributeTestCase::testAttributeUIAttributeOptionsEdit in Ubercart 7.3
Same name and namespace in other branches
- 6.2 uc_attribute/uc_attribute.test \UbercartAttributeTestCase::testAttributeUIAttributeOptionsEdit()
Tests the "edit attribute options" user interface.
File
- uc_attribute/
tests/ uc_attribute.test, line 485 - Ubercart Attribute Tests.
Class
- UbercartAttributeTestCase
- SimpleTests for the Ubercart Attributes API.
Code
public function testAttributeUIAttributeOptionsEdit() {
$attribute = self::createAttribute();
$option = self::createAttributeOption(array(
'aid' => $attribute->aid,
));
uc_attribute_option_save($option);
$this
->drupalGet('admin/store/products/attributes/' . $attribute->aid . '/options/' . $option->oid . '/edit');
$this
->assertText(t('Edit option: @name', array(
'@name' => $option->name,
)), t('Attribute options edit form working.'));
$edit = (array) self::createAttributeOption(array(
'aid' => $attribute->aid,
), FALSE);
unset($edit['aid']);
$this
->drupalPost('admin/store/products/attributes/' . $attribute->aid . '/options/' . $option->oid . '/edit', $edit, t('Submit'));
$option = uc_attribute_option_load($option->oid);
$fields_ok = TRUE;
foreach ($edit as $field => $value) {
if ($option->{$field} != $value) {
$this
->showVar($option);
$this
->showVar($edit);
$fields_ok = FALSE;
break;
}
}
$this
->assertTrue($fields_ok, t('Attribute option edited successfully by form.'));
}