public function UbercartAttributeTestCase::testAttributeUIProductAdjustments in Ubercart 7.3
Tests the "product adjustments" page.
File
- uc_attribute/
tests/ uc_attribute.test, line 695 - Ubercart Attribute Tests.
Class
- UbercartAttributeTestCase
- SimpleTests for the Ubercart Attributes API.
Code
public function testAttributeUIProductAdjustments() {
$product = $this
->createProduct();
$attribute = self::createAttribute(array(
'display' => 1,
));
for ($i = 0; $i < 3; $i++) {
$option = self::createAttributeOption(array(
'aid' => $attribute->aid,
));
$adjustment = self::createProductAdjustment(array(
'combination' => serialize(array(
$attribute->aid => $option->oid,
)),
'nid' => $product->nid,
));
$option->model = $adjustment->model;
$attribute->options[$option->oid] = $option;
}
uc_attribute_subject_save($attribute, 'product', $product->nid, TRUE);
$this
->drupalGet('node/' . $product->nid . '/edit/adjustments');
$this
->assertText('Default product SKU: ' . $product->model, 'Default product SKU found');
$this
->assertRaw('<th>' . $attribute->name . '</th>', 'Attribute name found');
foreach ($attribute->options as $option) {
$this
->assertRaw('<td>' . $option->name . '</td>', 'Option name found');
$this
->assertRaw($option->model, 'Option SKU found');
}
}