You are here

public function UbercartAttributeTestCase::testAttributeUIProductAttributeBulkUpdate in Ubercart 6.2

Tests the bulk product attribute update user interface.

File

uc_attribute/uc_attribute.test, line 749
Ubercart Attribute Tests

Class

UbercartAttributeTestCase
SimpleTests for the Ubercart Attributes API.

Code

public function testAttributeUIProductAttributeBulkUpdate() {
  $class = $this
    ->createProductClass();
  $attribute = self::createAttribute();
  uc_attribute_subject_save($attribute, 'class', $class->pcid);
  $product = $this
    ->createProduct(array(
    'type' => $class->pcid,
  ));
  $edit = array();
  $edit["attributes[{$attribute->aid}][remove]"] = TRUE;
  $this
    ->drupalPost('node/' . $product->nid . '/edit/attributes', $edit, t('Save changes'));
  $this
    ->assertText(t('You must first add attributes to this product.'), t('Product attribute removed.'), t('Ubercart'));
  $this
    ->drupalGet('admin/store/products/classes/' . $class->pcid . '/attributes_bulk');
  $this
    ->assertText($product->title, t('Product name found.'), t('Ubercart'));
  $this
    ->drupalPost(NULL, array(), t('Flush all'));
  $this
    ->drupalGet('node/' . $product->nid . '/edit/attributes');
  $this
    ->assertText($attribute->name, t('Product attribute reset successfully.'), t('Ubercart'));
}