You are here

class UbercartAttributeTestCase in Ubercart 6.2

Same name and namespace in other branches
  1. 7.3 uc_attribute/tests/uc_attribute.test \UbercartAttributeTestCase

SimpleTests for the Ubercart Attributes API.

Hierarchy

Expanded class hierarchy of UbercartAttributeTestCase

File

uc_attribute/uc_attribute.test, line 14
Ubercart Attribute Tests

View source
class UbercartAttributeTestCase extends UbercartTestHelper {
  public static function getInfo() {
    return array(
      'name' => 'Attribute API',
      'description' => 'Test the attribute API.',
      'group' => 'Ubercart',
    );
  }

  /**
   * Overrides DrupalWebTestCase::setUp().
   */
  function setUp() {
    parent::setUp(array(
      'uc_attribute',
    ), array(
      'administer attributes',
      'administer nodes',
    ));
    $this
      ->drupalLogin($this->adminUser);
  }

  /**
   * Tests the basic attribute API.
   */
  public function testAttributeAPI() {

    // Create an attribute.
    $attribute = self::createAttribute();

    // Test retrieval.
    $loaded_attribute = uc_attribute_load($attribute->aid);

    // Check the attribute integrity.
    foreach (self::attributeFieldsToTest() as $field) {
      if ($loaded_attribute->{$field} != $attribute->{$field}) {
        $this
          ->fail(t('Attribute integrity check failed.'), t('Ubercart'));
        break;
      }
    }

    // Add a product.
    $product = $this
      ->createProduct();

    // Attach the attribute to a product.
    uc_attribute_subject_save($attribute, 'product', $product->nid);

    // Confirm the database is correct.
    $this
      ->assertEqual($attribute->aid, db_result(db_query("SELECT aid FROM {uc_product_attributes} WHERE nid = %d", $product->nid)), t('Attribute was attached to a product properly.'), t('Ubercart'));
    $this
      ->assertTrue(uc_attribute_subject_exists($attribute->aid, 'product', $product->nid));

    // Test retrieval.
    $loaded_attribute = uc_attribute_load($attribute->aid, $product->nid, 'product');

    // Check the attribute integrity.
    foreach (self::attributeFieldsToTest('product') as $field) {
      if ($loaded_attribute->{$field} != $attribute->{$field}) {
        $this
          ->fail(t('Attribute integrity check failed.'), t('Ubercart'));
        break;
      }
    }

    // Delete it.
    uc_attribute_subject_delete($attribute->aid, 'product', $product->nid);

    // Confirm again.
    $this
      ->assertFalse(db_result(db_query("SELECT aid FROM {uc_product_attributes} WHERE nid = %d", $product->nid)), t('Attribute was detached from a product properly.'), t('Ubercart'));
    $this
      ->assertFalse(uc_attribute_subject_exists($attribute->aid, 'product', $product->nid));

    // Add a product class.
    $product_class = $this
      ->createProductClass();

    // Attach the attribute to a product class.
    uc_attribute_subject_save($attribute, 'class', $product_class->pcid);

    // Confirm the database is correct.
    $this
      ->assertEqual($attribute->aid, db_result(db_query("SELECT aid FROM {uc_class_attributes} WHERE pcid = '%s'", $product_class->pcid)), t('Attribute was attached to a product class properly.'), t('Ubercart'));
    $this
      ->assertTrue(uc_attribute_subject_exists($attribute->aid, 'class', $product_class->pcid));

    // Test retrieval.
    $loaded_attribute = uc_attribute_load($attribute->aid, $product_class->pcid, 'class');

    // Check the attribute integrity.
    foreach (self::attributeFieldsToTest('class') as $field) {
      if ($loaded_attribute->{$field} != $attribute->{$field}) {
        $this
          ->fail(t('Attribute integrity check failed.'), t('Ubercart'));
        break;
      }
    }

    // Delete it.
    uc_attribute_subject_delete($attribute->aid, 'class', $product_class->pcid);

    // Confirm again.
    $this
      ->assertFalse(db_result(db_query("SELECT aid FROM {uc_class_attributes} WHERE pcid = '%s'", $product_class->pcid)), t('Attribute was detached from a product class properly.'), t('Ubercart'));
    $this
      ->assertFalse(uc_attribute_subject_exists($attribute->aid, 'class', $product_class->pcid));

    // Create a few more.
    for ($i = 0; $i < 5; $i++) {
      $a = self::createAttribute();
      $attributes[$a->aid] = $a;
    }

    // Add some options, organizing them by aid and oid.
    $attribute_aids = array_keys($attributes);
    $all_options = array();
    foreach ($attribute_aids as $aid) {
      for ($i = 0; $i < 3; $i++) {
        $option = self::createAttributeOption(array(
          'aid' => $aid,
        ));
        $all_options[$option->aid][$option->oid] = $option;
      }
    }
    for ($i = 0; $i < 3; $i++) {
      $option = self::createAttributeOption(array(
        'aid' => $attribute->aid,
      ));
      $all_options[$option->aid][$option->oid] = $option;
    }

    // Get the options.
    $attribute = uc_attribute_load($attribute->aid);

    // Load every attribute we got.
    $attributes_with_options = uc_attribute_load_multiple();

    // Make sure all the new options are on attributes correctly.
    foreach ($all_options as $aid => $options) {
      foreach ($options as $oid => $option) {
        foreach (self::attributeOptionFieldsToTest() as $field) {
          if ($option->{$field} != $attributes_with_options[$aid]->options[$oid]->{$field}) {
            $this
              ->fail(t('Option integrity check failed.'), t('Ubercart'));
            break;
          }
        }
      }
    }

    // Pick 5 keys to check at random.
    $aids = drupal_map_assoc(array_rand($attributes, 3));

    // Load the attributes back.
    $loaded_attributes = uc_attribute_load_multiple($aids);

    // Make sure we only got the attributes we asked for. No more, no less.
    $this
      ->assertEqual(count($aids), count($loaded_attributes), t('Verifying attribute result.'), t('Ubercart'));
    $this
      ->assertEqual(count($aids), count(array_intersect_key($aids, $loaded_attributes)), t('Verifying attribute result.'), t('Ubercart'));

    // Check the attributes' integrity.
    foreach ($loaded_attributes as $aid => $loaded_attribute) {
      foreach (self::attributeFieldsToTest() as $field) {
        if ($attributes[$aid]->{$field} != $loaded_attributes[$aid]->{$field}) {
          $this
            ->fail(t('Attribute integrity check failed.'), t('Ubercart'));
          break;
        }
      }
    }

    // Add the selected attributes to the product.
    foreach ($loaded_attributes as $loaded_attribute) {
      uc_attribute_subject_save($loaded_attribute, 'product', $product->nid, TRUE);
    }

    // Test loading all product attributes. (This covers uc_attribute_load_product_attributes(),
    // as the semantics are the same -cha0s)
    $loaded_product_attributes = uc_attribute_load_multiple(array(), 'product', $product->nid);

    // We'll get all in $loaded_attributes above, plus the original.
    $product_attributes = $loaded_attributes;

    // Make sure we only got the attributes we asked for. No more, no less.
    $this
      ->assertEqual(count($loaded_product_attributes), count($product_attributes), t('Verifying attribute result.'), t('Ubercart'));
    $this
      ->assertEqual(count($loaded_product_attributes), count(array_intersect_key($loaded_product_attributes, $product_attributes)), t('Verifying attribute result.'), t('Ubercart'));

    // Check the attributes' integrity.
    foreach ($loaded_product_attributes as $aid => $loaded_product_attribute) {
      foreach (self::attributeFieldsToTest('product') as $field) {
        if ($loaded_product_attributes[$aid]->{$field} != $product_attributes[$aid]->{$field}) {
          $this
            ->fail(t('Attribute integrity check failed.'), t('Ubercart'));
          break;
        }
      }
    }

    // Make sure all the options are on attributes correctly.
    foreach ($all_options as $aid => $options) {
      foreach ($options as $oid => $option) {
        if (empty($loaded_product_attributes[$aid]) || empty($loaded_product_attributes[$aid]->options[$oid])) {
          continue;
        }
        foreach (self::attributeOptionFieldsToTest() as $field) {
          if ($option->{$field} != $loaded_product_attributes[$aid]->options[$oid]->{$field}) {
            $this
              ->fail(t('Option integrity check failed.'), t('Ubercart'));
            break;
          }
        }
      }
    }

    // Add the selected attributes to the product.
    foreach ($loaded_attributes as $loaded_attribute) {
      uc_attribute_subject_save($loaded_attribute, 'class', $product_class->pcid, TRUE);
    }

    // Test loading all product attributes. (This covers uc_attribute_load_product_attributes(),
    // as the semantics are the same -cha0s)
    $loaded_class_attributes = uc_attribute_load_multiple(array(), 'class', $product_class->pcid);

    // We'll get all in $loaded_attributes above, plus the original.
    $class_attributes = $loaded_attributes;

    // Make sure we only got the attributes we asked for. No more, no less.
    $this
      ->assertEqual(count($loaded_class_attributes), count($class_attributes), t('Verifying attribute result.'), t('Ubercart'));
    $this
      ->assertEqual(count($loaded_class_attributes), count(array_intersect_key($loaded_class_attributes, $class_attributes)), t('Verifying attribute result.'), t('Ubercart'));

    // Check the attributes' integrity.
    foreach ($loaded_class_attributes as $aid => $loaded_class_attribute) {
      foreach (self::attributeFieldsToTest('class') as $field) {
        if ($loaded_class_attributes[$aid]->{$field} != $class_attributes[$aid]->{$field}) {
          $this
            ->fail(t('Attribute integrity check failed.'), t('Ubercart'));
          break;
        }
      }
    }

    // Make sure all the options are on attributes correctly.
    foreach ($all_options as $aid => $options) {
      foreach ($options as $oid => $option) {
        if (empty($loaded_class_attributes[$aid]) || empty($loaded_class_attributes[$aid]->options[$oid])) {
          continue;
        }
        foreach (self::attributeOptionFieldsToTest() as $field) {
          if ($option->{$field} != $loaded_class_attributes[$aid]->options[$oid]->{$field}) {
            $this
              ->fail(t('Option integrity check failed.'), t('Ubercart'));
            break;
          }
        }
      }
    }

    // Test deletion of base attribute.
    $aid = $attribute->aid;
    $options = $attribute->options;
    uc_attribute_delete($attribute->aid);
    $this
      ->assertFalse(uc_attribute_load($attribute->aid), t('Attribute was deleted properly.'), t('Ubercart'));

    // Sanity check!
    $this
      ->assertFalse(db_result(db_query("SELECT aid FROM {uc_attributes} WHERE aid = %d", $attribute->aid)), t('Attribute was seriously deleted properly!'), t('Ubercart'));

    // Test that options were deleted properly.
    foreach ($options as $option) {
      $this
        ->assertFalse(db_result(db_query("SELECT oid FROM {uc_attribute_options} WHERE oid = %d", $option->oid)), t('Make sure options are deleted properly.'), t('Ubercart'));
    }

    // Test the deletion applied to products too.
    $loaded_product_attributes = uc_attribute_load_multiple(array(), 'product', $product->nid);

    // We'll get all in $loaded_attributes above, without the original. (Which
    // has been deleted.)
    $product_attributes = $loaded_attributes;

    // Make sure we only got the attributes we asked for. No more, no less.
    $this
      ->assertEqual(count($loaded_product_attributes), count($product_attributes), t('Verifying attribute result.'), t('Ubercart'));
    $this
      ->assertEqual(count($loaded_product_attributes), count(array_intersect_key($loaded_product_attributes, $product_attributes)), t('Verifying attribute result.'), t('Ubercart'));

    // Test the deletion applied to classes too.
    $loaded_class_attributes = uc_attribute_load_multiple(array(), 'class', $product_class->pcid);

    // We'll get all in $loaded_attributes above, without the original. (Which
    // has been deleted.)
    $class_attributes = $loaded_attributes;

    // Make sure we only got the attributes we asked for. No more, no less.
    $this
      ->assertEqual(count($loaded_class_attributes), count($class_attributes), t('Verifying attribute result.'), t('Ubercart'));
    $this
      ->assertEqual(count($loaded_class_attributes), count(array_intersect_key($loaded_class_attributes, $class_attributes)), t('Verifying attribute result.'), t('Ubercart'));

    // Add some adjustments.
    self::createProductAdjustment(array(
      'combination' => 'a:1:{i:1;s:1:"1";}',
      'nid' => 1,
    ));
    self::createProductAdjustment(array(
      'combination' => 'a:1:{i:1;s:1:"2";}',
      'nid' => 1,
    ));
    self::createProductAdjustment(array(
      'combination' => 'a:1:{i:1;s:1:"3";}',
      'nid' => 1,
    ));
    self::createProductAdjustment(array(
      'combination' => 'a:1:{i:2;s:1:"1";}',
      'nid' => 2,
    ));
    self::createProductAdjustment(array(
      'combination' => 'a:1:{i:3;s:1:"1";}',
      'nid' => 2,
    ));
    self::createProductAdjustment(array(
      'combination' => 'a:1:{i:1;s:1:"2";}',
      'nid' => 3,
    ));
    self::createProductAdjustment(array(
      'combination' => 'a:1:{i:1;s:1:"3";}',
      'nid' => 3,
    ));
    self::createProductAdjustment(array(
      'combination' => 'a:1:{i:3;s:1:"2";}',
      'nid' => 3,
    ));
    self::createProductAdjustment(array(
      'combination' => 'a:1:{i:3;s:1:"3";}',
      'nid' => 4,
    ));

    // Test deletion by nid.
    uc_attribute_adjustments_delete(array(
      'nid' => 1,
    ));
    $this
      ->assertEqual(6, db_result(db_query("SELECT COUNT(*) FROM {uc_product_adjustments}")), t('Ubercart'));

    // Test deletion by aid.
    uc_attribute_adjustments_delete(array(
      'aid' => 2,
    ));
    $this
      ->assertEqual(5, db_result(db_query("SELECT COUNT(*) FROM {uc_product_adjustments}")), t('Ubercart'));

    // Test deletion by oid.
    uc_attribute_adjustments_delete(array(
      'oid' => 2,
    ));
    $this
      ->assertEqual(3, db_result(db_query("SELECT COUNT(*) FROM {uc_product_adjustments}")), t('Ubercart'));

    // Test deletion by aid and oid.
    uc_attribute_adjustments_delete(array(
      'aid' => 1,
      'oid' => 3,
    ));
    $this
      ->assertEqual(2, db_result(db_query("SELECT COUNT(*) FROM {uc_product_adjustments}")), t('Ubercart'));
  }

  /**
   * Tests the "add attribute" user interface.
   */
  public function testAttributeUIAddAttribute() {
    $this
      ->drupalGet('admin/store/attributes/add');
    $this
      ->AssertText(t('The name of the attribute used in administrative forms'), t('Attribute add form working.'), t('Ubercart'));
    $edit = (array) self::createAttribute(array(), FALSE);
    $this
      ->drupalPost('admin/store/attributes/add', $edit, t('Submit'));
    $this
      ->assertRaw('<td class="active">' . $edit['name'] . '</td>', t('Verify name field.'), t('Ubercart'));
    $this
      ->assertRaw('<td>' . $edit['label'] . '</td>', t('Verify label field.'), t('Ubercart'));
    $this
      ->assertRaw('<td>' . ($edit['required'] ? t('Yes') : t('No')) . '</td>', t('Verify required field.'), t('Ubercart'));
    $this
      ->assertRaw('<td align="center">' . $edit['ordering'] . '</td>', t('Verify ordering field.'), t('Ubercart'));
    $types = _uc_attribute_display_types();
    $this
      ->assertRaw('<td>' . $types[$edit['display']] . '</td>', t('Verify display field.'), t('Ubercart'));
    $aid = db_result(db_query("SELECT aid FROM {uc_attributes} WHERE name = '%s'", $edit['name']));
    $this
      ->assertTrue($aid, t('Attribute was created.'));
    $attribute = uc_attribute_load($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 created properly.'), t('Ubercart'));
  }

  /**
   * Tests the attribute settings page.
   */
  public function testAttributeUISettings() {
    $product = $this
      ->createProduct();
    $attribute = self::createAttribute(array(
      'display' => 1,
    ));
    $option = self::createAttributeOption(array(
      'aid' => $attribute->aid,
      'price' => 30,
    ));
    $attribute->options[$option->oid] = $option;
    uc_attribute_subject_save($attribute, 'product', $product->nid, TRUE);
    $context = array(
      'revision' => 'formatted',
      'location' => 'product-attribute-form-element',
      'subject' => array(
        'attribute' => $attribute,
      ),
      'extras' => array(
        'option' => $option,
      ),
    );
    $qty = $product->default_qty;
    if (!$qty) {
      $qty = 1;
    }
    $price_info = array(
      'price' => $option->price,
      'qty' => $qty,
    );
    $adjust_price = uc_price($price_info, $context);
    $price_info['price'] += $product->sell_price;
    $total_price = uc_price($price_info, $context);
    $raw = array(
      'none' => $option->name . '</option>',
      'adjustment' => $option->name . ', +' . $adjust_price . '</option>',
      'total' => $total_price . '</option>',
    );
    foreach (array(
      'none',
      'adjustment',
      'total',
    ) as $type) {
      $edit['uc_attribute_option_price_format'] = $type;
      $this
        ->drupalPost('admin/store/settings/attributes', $edit, t('Save configuration'));
      $this
        ->drupalGet('node/' . $product->nid);
      $this
        ->AssertRaw($raw[$type], t('Attribute option pricing is correct.'), t('Ubercart'));
    }
  }

  /**
   * Tests the "edit attribute" user interface.
   */
  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'));
  }

  /**
   * Tests the "delete attribute" user interface.
   */
  public function testAttributeUIDeleteAttribute() {
    $attribute = self::createAttribute();
    $this
      ->drupalGet('admin/store/attributes/' . $attribute->aid . '/delete');
    $this
      ->AssertText(t('Are you sure you want to delete the attribute @name?', array(
      '@name' => $attribute->name,
    )), t('Attribute delete form working.'), t('Ubercart'));
    $edit = (array) self::createAttribute();
    unset($edit['aid']);
    $this
      ->drupalPost('admin/store/attributes/' . $attribute->aid . '/delete', array(), t('Delete'));
    $this
      ->AssertText(t('Product attribute deleted.'), t('Attribute deleted properly.'), t('Ubercart'));
  }

  /**
   * Tests the attribute options user interface.
   */
  public function testAttributeUIAttributeOptions() {
    $attribute = self::createAttribute();
    $option = self::createAttributeOption(array(
      'aid' => $attribute->aid,
    ));
    uc_attribute_option_save($option);
    $this
      ->drupalGet('admin/store/attributes/' . $attribute->aid . '/options');
    $this
      ->AssertText(t('Options for @name', array(
      '@name' => $attribute->name,
    )), t('Attribute options form working.'), t('Ubercart'));
  }

  /**
   * Tests the "add attribute option" user interface.
   */
  public function testAttributeUIAttributeOptionsAdd() {
    $attribute = self::createAttribute();
    $this
      ->drupalGet('admin/store/attributes/' . $attribute->aid . '/options/add');
    $this
      ->AssertText(t('Options for @name', array(
      '@name' => $attribute->name,
    )), t('Attribute options add form working.'), t('Ubercart'));
    $edit = (array) self::createAttributeOption(array(
      'aid' => $attribute->aid,
    ), FALSE);
    unset($edit['aid']);
    $this
      ->drupalPost('admin/store/attributes/' . $attribute->aid . '/options/add', $edit, t('Submit'));
    $option = db_fetch_object(db_query("SELECT * FROM {uc_attribute_options} WHERE aid = %d", $attribute->aid));
    $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 added successfully by form.'), t('Ubercart'));
  }

  /**
   * Tests the "edit attribute options" user interface.
   */
  public function testAttributeUIAttributeOptionsEdit() {
    $attribute = self::createAttribute();
    $option = self::createAttributeOption(array(
      'aid' => $attribute->aid,
    ));
    uc_attribute_option_save($option);
    $this
      ->drupalGet('admin/store/attributes/' . $attribute->aid . '/options/' . $option->oid . '/edit');
    $this
      ->AssertText(t('Edit option: @name', array(
      '@name' => $option->name,
    )), t('Attribute options edit form working.'), t('Ubercart'));
    $edit = (array) self::createAttributeOption(array(
      'aid' => $attribute->aid,
    ), FALSE);
    unset($edit['aid']);
    $this
      ->drupalPost('admin/store/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.'), t('Ubercart'));
  }

  /**
   * Tests the "bulk edit attribute options" user interface.
   */
  public function testAttributeUIAttributeOptionsBulkEdit() {
    $attribute = self::createAttribute();
    $option = self::createAttributeOption(array(
      'aid' => $attribute->aid,
    ));
    uc_attribute_option_save($option);
    $class = $this
      ->createProductClass();
    uc_attribute_subject_save($attribute, 'class', $class->pcid);
    uc_attribute_subject_option_save($option, 'class', $class->pcid);
    $product = $this
      ->createProduct();
    uc_attribute_subject_save($attribute, 'product', $product->nid);
    uc_attribute_subject_option_save($option, 'product', $product->nid);
    $edit = (array) self::createAttributeOption(array(
      'aid' => $attribute->aid,
    ), FALSE);
    unset($edit['aid']);
    $edit['bulk_update'] = TRUE;
    $this
      ->drupalPost('admin/store/attributes/' . $attribute->aid . '/options/' . $option->oid . '/edit', $edit, t('Submit'));
    unset($edit['bulk_update']);
    $this
      ->assertText('Bulk updates applied', t('Bulk update selected.'), t('Ubercart'));
    $option = uc_attribute_subject_option_load($option->oid, 'class', $class->pcid);
    $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('Class bulk updated successfully.'), t('Ubercart'));
    $product_attributes = uc_attribute_load_multiple(array(), 'product', $product->nid);
    $fields_ok = TRUE;
    foreach ($edit as $field => $value) {
      if ($product_attributes[$attribute->aid]->options[$option->oid]->{$field} != $value) {
        $this
          ->showVar($product_attributes);
        $this
          ->showVar($edit);
        $fields_ok = FALSE;
        break;
      }
    }
    $this
      ->assertTrue($fields_ok, t('Product bulk updated successfully.'), t('Ubercart'));
  }

  /**
   * Tests the "delete attribute option" user interface.
   */
  public function testAttributeUIAttributeOptionsDelete() {
    $attribute = self::createAttribute();
    $option = self::createAttributeOption(array(
      'aid' => $attribute->aid,
    ));
    uc_attribute_option_save($option);
    $this
      ->drupalGet('admin/store/attributes/' . $attribute->aid . '/options/' . $option->oid . '/delete');
    $this
      ->AssertText(t('Are you sure you want to delete the option @name?', array(
      '@name' => $option->name,
    )), t('Attribute options delete form working.'), t('Ubercart'));
    $this
      ->drupalPost('admin/store/attributes/' . $attribute->aid . '/options/' . $option->oid . '/delete', array(), t('Delete'));
    $option = uc_attribute_option_load($option->oid);
    $this
      ->assertFalse($option, t('Attribute option deleted successfully by form'), t('Ubercart'));
  }

  /**
   * Tests the product class attribute user interface.
   */
  public function testAttributeUIClassAttributeOverview() {
    $class = $this
      ->createProductClass();
    $attribute = self::createAttribute();
    $this
      ->drupalGet('admin/store/products/classes/' . $class->pcid . '/attributes');
    $this
      ->assertText(t('You must first add attributes to this class.'), t('Class attribute form working.'), t('Ubercart'));
    uc_attribute_subject_save($attribute, 'class', $class->pcid);
    $this
      ->drupalGet('admin/store/products/classes/' . $class->pcid . '/attributes');
    $this
      ->assertNoText(t('You must first add attributes to this class.'), t('Class attribute form working.'), t('Ubercart'));
    $a = (array) self::createAttribute(array(), FALSE);
    unset($a['name'], $a['description']);
    foreach ($a as $field => $value) {
      $edit["attributes[{$attribute->aid}][{$field}]"] = $value;
    }
    $this
      ->showVar($edit);
    $this
      ->drupalPost('admin/store/products/classes/' . $class->pcid . '/attributes', $edit, t('Save changes'));
    $attribute = uc_attribute_load($attribute->aid, $class->pcid, 'class');
    $fields_ok = TRUE;
    foreach ($a as $field => $value) {
      if ($attribute->{$field} != $value) {
        $this
          ->showVar($attribute);
        $this
          ->showVar($a);
        $fields_ok = FALSE;
        break;
      }
    }
    $this
      ->assertTrue($fields_ok, t('Class attribute edited successfully by form.'), t('Ubercart'));
    $edit = array();
    $edit["attributes[{$attribute->aid}][remove]"] = TRUE;
    $this
      ->drupalPost('admin/store/products/classes/' . $class->pcid . '/attributes', $edit, t('Save changes'));
    $this
      ->assertText(t('You must first add attributes to this class.'), t('Class attribute form working.'), t('Ubercart'));
  }

  /**
   * Tests the "add product class attribute option" user interface.
   */
  public function testAttributeUIClassAttributeAdd() {
    $class = $this
      ->createProductClass();
    $attribute = self::createAttribute();
    $this
      ->drupalGet('admin/store/products/classes/' . $class->pcid . '/attributes/add');
    $this
      ->assertRaw(t('@attribute</option>', array(
      '@attribute' => $attribute->name,
    )), t('Class attribute add form working.'), t('Ubercart'));
    $edit["add_attributes[]"] = $attribute->aid;
    $this
      ->drupalPost('admin/store/products/classes/' . $class->pcid . '/attributes/add', $edit, t('Add attributes'));
    $this
      ->assertNoText(t('You must first add attributes to this class.'), t('Class attribute form working.'), t('Ubercart'));
  }

  /**
   * Tests the product class attribute option user interface.
   */
  public function testAttributeUIClassAttributeOptionOverview() {
    $class = $this
      ->createProductClass();
    $attribute = self::createAttribute();
    $option = self::createAttributeOption(array(
      'aid' => $attribute->aid,
    ));
    uc_attribute_subject_save($attribute, 'class', $class->pcid);
    $this
      ->drupalGet('admin/store/products/classes/' . $class->pcid . '/options');
    $this
      ->assertRaw(t(' @option</label>', array(
      '@option' => $option->name,
    )), t('Class attribute option form working.'), t('Ubercart'));
    $o = (array) self::createAttributeOption(array(
      'aid' => $attribute->aid,
    ), FALSE);
    unset($o['name'], $o['aid']);
    $o['select'] = TRUE;
    foreach ($o as $field => $value) {
      $edit["attributes[{$attribute->aid}][options][{$option->oid}][{$field}]"] = $value;
    }
    unset($o['select']);
    $edit["attributes[{$attribute->aid}][default]"] = $option->oid;
    $this
      ->showVar($edit);
    $this
      ->drupalPost('admin/store/products/classes/' . $class->pcid . '/options', $edit, t('Submit'));
    $this
      ->assertText('The product class options have been saved.', t('Class attribute option saved.'), t('Ubercart'));
    $this
      ->showVar($option);
    $option = uc_attribute_subject_option_load($option->oid, 'class', $class->pcid);
    $fields_ok = TRUE;
    foreach ($o as $field => $value) {
      if ($option->{$field} != $value) {
        $this
          ->showVar($option);
        $this
          ->showVar($o);
        $fields_ok = FALSE;
        break;
      }
    }
    $this
      ->assertTrue($fields_ok, t('Class attribute option edited successfully by form.'), t('Ubercart'));
  }

  /**
   * Tests the product node attribute user interface.
   */
  public function testAttributeUIProductAttributeOverview() {
    $class = $this
      ->createProductClass();
    $attribute = self::createAttribute();
    uc_attribute_subject_save($attribute, 'class', $class->pcid);
    $product = $this
      ->createProduct(array(
      'type' => $class->pcid,
    ));

    // Check product has attribute added by default.
    $loaded_attribute = uc_attribute_load($attribute->aid, $product->nid, 'product');
    $this
      ->assertEqual($attribute->name, $loaded_attribute->name, t('Product attribute added by default.'), t('Ubercart'));
    uc_attribute_subject_delete($attribute->aid, 'product', $product->nid);
    $this
      ->drupalGet('node/' . $product->nid . '/edit/attributes/add');
    $edit = array();
    $edit['add_attributes[]'] = $attribute->aid;
    $this
      ->drupalPost(NULL, $edit, t('Add attributes'));
    $this
      ->assertText($attribute->name, t('Product attribute added.'), t('Ubercart'));
    $edit = array();
    $edit["attributes[{$attribute->aid}][remove]"] = TRUE;
    $this
      ->drupalPost(NULL, $edit, t('Save changes'));
    $this
      ->assertText(t('You must first add attributes to this product.'), t('Product attribute removed.'), t('Ubercart'));
    $this
      ->drupalPost(NULL, array(), t('Reset to defaults'));
    $this
      ->drupalPost(NULL, array(), t('Reset'));
    $this
      ->assertText($attribute->name, t('Product attribute reset successfully.'), t('Ubercart'));
  }

  /**
   * Tests the bulk product attribute update user interface.
   */
  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'));
  }

  /**
   * Creates a product adjustment SKU.
   *
   * @param $data
   */
  public static function createProductAdjustment($data) {
    $adjustment = $data + array(
      'model' => self::randomName(8),
    );
    db_query("INSERT INTO {uc_product_adjustments} (nid, combination, model) VALUES (%d, '%s', '%s')", $adjustment['nid'], $adjustment['combination'], $adjustment['model']);
  }

  /**
   * Returns an array of available fields for product or class attributes.
   *
   * @param $type
   */
  protected static function attributeFieldsToTest($type = '') {
    $fields = array(
      'aid',
      'name',
      'ordering',
      'required',
      'display',
      'description',
      'label',
    );
    switch ($type) {
      case 'product':
      case 'class':
        $info = uc_attribute_type_info($type);
        $fields = array_merge($fields, array(
          $info['id'],
        ));
        break;
    }
    return $fields;
  }

  /**
   * Tests the product class attribute option user interface.
   */
  protected static function attributeOptionFieldsToTest($type = '') {
    $fields = array(
      'aid',
      'oid',
      'name',
      'cost',
      'price',
      'weight',
      'ordering',
    );
    switch ($type) {
      case 'product':
      case 'class':
        $info = uc_attribute_type_info($type);
        $fields = array_merge($fields, array(
          $info['id'],
        ));
        break;
    }
    return $fields;
  }

  /**
   * Tests the product class attribute option user interface.
   */
  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;
  }

  /**
   * Creates an attribute option.
   *
   * @param $data
   * @param $save
   */
  public static function createAttributeOption($data = array(), $save = TRUE) {
    $option = $data + array(
      'name' => DrupalWebTestCase::randomName(8),
      'cost' => mt_rand(-500, 500),
      'price' => mt_rand(-500, 500),
      'weight' => mt_rand(-500, 500),
      'ordering' => mt_rand(-10, 10),
    );
    $option = (object) $option;
    if ($save) {
      uc_attribute_option_save($option);
    }
    return $option;
  }

  /**
   * Creates an attribute option.
   *
   * @param $data
   * @param $save
   */
  function showVar($var) {
    $this
      ->pass('<pre>' . print_r($var, TRUE) . '</pre>');
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DrupalTestCase::$assertions protected property Assertions thrown in that test case.
DrupalTestCase::$databasePrefix protected property The database prefix of this test run.
DrupalTestCase::$originalFileDirectory protected property The original file directory, before it was changed for testing purposes.
DrupalTestCase::$originalPrefix protected property The original database prefix, before it was changed for testing purposes.
DrupalTestCase::$results public property Current results of this test case.
DrupalTestCase::$skipClasses protected property This class is skipped when looking for the source of an assertion.
DrupalTestCase::$testId protected property The test run ID.
DrupalTestCase::$timeLimit protected property Time limit for the test.
DrupalTestCase::assert protected function Internal helper: stores the assert.
DrupalTestCase::assertEqual protected function Check to see if two values are equal.
DrupalTestCase::assertFalse protected function Check to see if a value is false (an empty string, 0, NULL, or FALSE).
DrupalTestCase::assertIdentical protected function Check to see if two values are identical.
DrupalTestCase::assertNotEqual protected function Check to see if two values are not equal.
DrupalTestCase::assertNotIdentical protected function Check to see if two values are not identical.
DrupalTestCase::assertNotNull protected function Check to see if a value is not NULL.
DrupalTestCase::assertNull protected function Check to see if a value is NULL.
DrupalTestCase::assertTrue protected function Check to see if a value is not false (not an empty string, 0, NULL, or FALSE).
DrupalTestCase::deleteAssert public static function Delete an assertion record by message ID.
DrupalTestCase::error protected function Fire an error assertion.
DrupalTestCase::errorHandler public function Handle errors during test runs.
DrupalTestCase::exceptionHandler protected function Handle exceptions.
DrupalTestCase::fail protected function Fire an assertion that is always negative.
DrupalTestCase::generatePermutations public static function Converts a list of possible parameters into a stack of permutations.
DrupalTestCase::getAssertionCall protected function Cycles through backtrace until the first non-assertion method is found.
DrupalTestCase::insertAssert public static function Store an assertion from outside the testing context.
DrupalTestCase::pass protected function Fire an assertion that is always positive.
DrupalTestCase::randomName public static function Generates a random string containing letters and numbers.
DrupalTestCase::randomString public static function Generates a random string of ASCII characters of codes 32 to 126.
DrupalTestCase::run public function Run all tests in this class.
DrupalTestCase::verbose protected function Logs verbose message in a text file.
DrupalWebTestCase::$additionalCurlOptions protected property Additional cURL options.
DrupalWebTestCase::$content protected property The content of the page currently loaded in the internal browser.
DrupalWebTestCase::$cookieFile protected property The current cookie file used by cURL.
DrupalWebTestCase::$curlHandle protected property The handle of the current cURL connection.
DrupalWebTestCase::$drupalSettings protected property The value of the Drupal.settings JavaScript variable for the page currently loaded in the internal browser.
DrupalWebTestCase::$elements protected property The parsed version of the page.
DrupalWebTestCase::$generatedTestFiles protected property Whether the files were copied to the test files directory.
DrupalWebTestCase::$headers protected property The headers of the page currently loaded in the internal browser.
DrupalWebTestCase::$httpauth_credentials protected property HTTP authentication credentials (<username>:<password>).
DrupalWebTestCase::$httpauth_method protected property HTTP authentication method
DrupalWebTestCase::$loggedInUser protected property The current user logged in using the internal browser.
DrupalWebTestCase::$originalUser protected property The original user, before it was changed to a clean uid = 1 for testing purposes.
DrupalWebTestCase::$plainTextContent protected property The content of the page currently loaded in the internal browser (plain text version).
DrupalWebTestCase::$profile protected property The profile to install as a basis for testing.
DrupalWebTestCase::$redirect_count protected property The number of redirects followed during the handling of a request.
DrupalWebTestCase::$session_id protected property The current session ID, if available.
DrupalWebTestCase::$session_name protected property The current session name, if available.
DrupalWebTestCase::$url protected property The URL currently loaded in the internal browser.
DrupalWebTestCase::assertField protected function Asserts that a field exists with the given name or id.
DrupalWebTestCase::assertFieldById protected function Asserts that a field exists in the current page with the given id and value.
DrupalWebTestCase::assertFieldByName protected function Asserts that a field exists in the current page with the given name and value.
DrupalWebTestCase::assertFieldByXPath protected function Asserts that a field exists in the current page by the given XPath.
DrupalWebTestCase::assertFieldChecked protected function Asserts that a checkbox field in the current page is checked.
DrupalWebTestCase::assertLink protected function Pass if a link with the specified label is found, and optional with the specified index.
DrupalWebTestCase::assertLinkByHref protected function Pass if a link containing a given href (part) is found.
DrupalWebTestCase::assertMail protected function Asserts that the most recently sent e-mail message has the given value.
DrupalWebTestCase::assertMailPattern protected function Asserts that the most recently sent e-mail message has the pattern in it.
DrupalWebTestCase::assertMailString protected function Asserts that the most recently sent e-mail message has the string in it.
DrupalWebTestCase::assertNoDuplicateIds protected function Asserts that each HTML ID is used for just a single element.
DrupalWebTestCase::assertNoField protected function Asserts that a field does not exist with the given name or id.
DrupalWebTestCase::assertNoFieldById protected function Asserts that a field does not exist with the given id and value.
DrupalWebTestCase::assertNoFieldByName protected function Asserts that a field does not exist with the given name and value.
DrupalWebTestCase::assertNoFieldByXPath protected function Asserts that a field does not exist in the current page by the given XPath.
DrupalWebTestCase::assertNoFieldChecked protected function Asserts that a checkbox field in the current page is not checked.
DrupalWebTestCase::assertNoLink protected function Pass if a link with the specified label is not found.
DrupalWebTestCase::assertNoLinkByHref protected function Pass if a link containing a given href (part) is not found.
DrupalWebTestCase::assertNoOptionSelected protected function Asserts that a select option in the current page is not checked.
DrupalWebTestCase::assertNoPattern protected function Will trigger a pass if the perl regex pattern is not present in raw content.
DrupalWebTestCase::assertNoRaw protected function Pass if the raw text is NOT found on the loaded page, fail otherwise. Raw text refers to the raw HTML that the page generated.
DrupalWebTestCase::assertNoResponse protected function Asserts the page did not return the specified response code.
DrupalWebTestCase::assertNoText protected function Pass if the text is NOT found on the text version of the page. The text version is the equivalent of what a user would see when viewing through a web browser. In other words the HTML has been filtered out of the contents.
DrupalWebTestCase::assertNoTitle protected function Pass if the page title is not the given string.
DrupalWebTestCase::assertNoUniqueText protected function Pass if the text is found MORE THAN ONCE on the text version of the page.
DrupalWebTestCase::assertOptionSelected protected function Asserts that a select option in the current page is checked.
DrupalWebTestCase::assertPattern protected function Will trigger a pass if the Perl regex pattern is found in the raw content.
DrupalWebTestCase::assertRaw protected function Pass if the raw text IS found on the loaded page, fail otherwise. Raw text refers to the raw HTML that the page generated.
DrupalWebTestCase::assertResponse protected function Asserts the page responds with the specified response code.
DrupalWebTestCase::assertText protected function Pass if the text IS found on the text version of the page. The text version is the equivalent of what a user would see when viewing through a web browser. In other words the HTML has been filtered out of the contents.
DrupalWebTestCase::assertTextHelper protected function Helper for assertText and assertNoText.
DrupalWebTestCase::assertTitle protected function Pass if the page title is the given string.
DrupalWebTestCase::assertUniqueText protected function Pass if the text is found ONLY ONCE on the text version of the page.
DrupalWebTestCase::assertUniqueTextHelper protected function Helper for assertUniqueText and assertNoUniqueText.
DrupalWebTestCase::assertUrl protected function Pass if the internal browser's URL matches the given path.
DrupalWebTestCase::buildXPathQuery protected function Builds an XPath query.
DrupalWebTestCase::checkForMetaRefresh protected function Check for meta refresh tag and if found call drupalGet() recursively. This function looks for the http-equiv attribute to be set to "Refresh" and is case-sensitive.
DrupalWebTestCase::checkPermissions protected function Check to make sure that the array of permissions are valid.
DrupalWebTestCase::clickLink protected function Follows a link by name.
DrupalWebTestCase::constructFieldXpath protected function Helper function: construct an XPath for the given set of attributes and value.
DrupalWebTestCase::curlClose protected function Close the cURL handler and unset the handler.
DrupalWebTestCase::curlExec protected function Initializes and executes a cURL request.
DrupalWebTestCase::curlHeaderCallback protected function Reads headers and registers errors received from the tested site.
DrupalWebTestCase::curlInitialize protected function Initializes the cURL connection.
DrupalWebTestCase::drupalCompareFiles protected function Compare two files based on size and file name.
DrupalWebTestCase::drupalCreateContentType protected function Creates a custom content type based on default settings.
DrupalWebTestCase::drupalCreateNode protected function Creates a node based on default settings.
DrupalWebTestCase::drupalCreateRole protected function Internal helper function; Create a role with specified permissions.
DrupalWebTestCase::drupalCreateUser protected function Create a user with a given set of permissions. The permissions correspond to the names given on the privileges page.
DrupalWebTestCase::drupalGet protected function Retrieves a Drupal path or an absolute path.
DrupalWebTestCase::drupalGetContent protected function Gets the current raw HTML of requested page.
DrupalWebTestCase::drupalGetHeader protected function Gets the value of an HTTP response header. If multiple requests were required to retrieve the page, only the headers from the last request will be checked by default. However, if TRUE is passed as the second argument, all requests will be processed…
DrupalWebTestCase::drupalGetHeaders protected function Gets the HTTP response headers of the requested page. Normally we are only interested in the headers returned by the last request. However, if a page is redirected or HTTP authentication is in use, multiple requests will be required to retrieve the…
DrupalWebTestCase::drupalGetMails protected function Gets an array containing all e-mails sent during this test case.
DrupalWebTestCase::drupalGetNodeByTitle function Get a node from the database based on its title.
DrupalWebTestCase::drupalGetSettings protected function Gets the value of the Drupal.settings JavaScript variable for the currently loaded page.
DrupalWebTestCase::drupalGetTestFiles protected function Get a list files that can be used in tests.
DrupalWebTestCase::drupalGetToken protected function Generate a token for the currently logged in user.
DrupalWebTestCase::drupalHead protected function Retrieves only the headers for a Drupal path or an absolute path.
DrupalWebTestCase::drupalLogin protected function Log in a user with the internal browser.
DrupalWebTestCase::drupalLogout protected function
DrupalWebTestCase::drupalPost protected function Execute a POST request on a Drupal page. It will be done as usual POST request with SimpleBrowser.
DrupalWebTestCase::drupalSetContent protected function Sets the raw HTML content. This can be useful when a page has been fetched outside of the internal browser and assertions need to be made on the returned page.
DrupalWebTestCase::drupalSetSettings protected function Sets the value of the Drupal.settings JavaScript variable for the currently loaded page.
DrupalWebTestCase::getAbsoluteUrl protected function Takes a path and returns an absolute path.
DrupalWebTestCase::getAllOptions protected function Get all option elements, including nested options, in a select.
DrupalWebTestCase::getSelectedItem protected function Get the selected value from a select field.
DrupalWebTestCase::getUrl protected function Get the current url from the cURL handler.
DrupalWebTestCase::handleForm protected function Handle form input related to drupalPost(). Ensure that the specified fields exist and attempt to create POST data in the correct manner for the particular field type.
DrupalWebTestCase::parse protected function Parse content returned from curlExec using DOM and SimpleXML.
DrupalWebTestCase::refreshVariables protected function Refresh the in-memory set of variables. Useful after a page request is made that changes a variable in a different thread.
DrupalWebTestCase::resetAll protected function Reset all data structures after having enabled new modules.
DrupalWebTestCase::tearDown protected function Delete created files and temporary files directory, delete the tables created by setUp(), and reset the database prefix.
DrupalWebTestCase::verboseEmail protected function Outputs to verbose the most recent $count emails sent.
DrupalWebTestCase::xpath protected function Perform an xpath search on the contents of the internal browser. The search is relative to the root element (HTML tag normally) of the page.
DrupalWebTestCase::__construct function Constructor for DrupalWebTestCase. Overrides DrupalTestCase::__construct
UbercartAttributeTestCase::attributeFieldsToTest protected static function Returns an array of available fields for product or class attributes.
UbercartAttributeTestCase::attributeOptionFieldsToTest protected static function Tests the product class attribute option user interface.
UbercartAttributeTestCase::createAttribute public static function Tests the product class attribute option user interface.
UbercartAttributeTestCase::createAttributeOption public static function Creates an attribute option.
UbercartAttributeTestCase::createProductAdjustment public static function Creates a product adjustment SKU.
UbercartAttributeTestCase::getInfo public static function
UbercartAttributeTestCase::setUp function Overrides DrupalWebTestCase::setUp(). Overrides UbercartTestHelper::setUp
UbercartAttributeTestCase::showVar function Creates an attribute option.
UbercartAttributeTestCase::testAttributeAPI public function Tests the basic attribute API.
UbercartAttributeTestCase::testAttributeUIAddAttribute public function Tests the "add attribute" user interface.
UbercartAttributeTestCase::testAttributeUIAttributeOptions public function Tests the attribute options user interface.
UbercartAttributeTestCase::testAttributeUIAttributeOptionsAdd public function Tests the "add attribute option" user interface.
UbercartAttributeTestCase::testAttributeUIAttributeOptionsBulkEdit public function Tests the "bulk edit attribute options" user interface.
UbercartAttributeTestCase::testAttributeUIAttributeOptionsDelete public function Tests the "delete attribute option" user interface.
UbercartAttributeTestCase::testAttributeUIAttributeOptionsEdit public function Tests the "edit attribute options" user interface.
UbercartAttributeTestCase::testAttributeUIClassAttributeAdd public function Tests the "add product class attribute option" user interface.
UbercartAttributeTestCase::testAttributeUIClassAttributeOptionOverview public function Tests the product class attribute option user interface.
UbercartAttributeTestCase::testAttributeUIClassAttributeOverview public function Tests the product class attribute user interface.
UbercartAttributeTestCase::testAttributeUIDeleteAttribute public function Tests the "delete attribute" user interface.
UbercartAttributeTestCase::testAttributeUIEditAttribute public function Tests the "edit attribute" user interface.
UbercartAttributeTestCase::testAttributeUIProductAttributeBulkUpdate public function Tests the bulk product attribute update user interface.
UbercartAttributeTestCase::testAttributeUIProductAttributeOverview public function Tests the product node attribute user interface.
UbercartAttributeTestCase::testAttributeUISettings public function Tests the attribute settings page.
UbercartTestHelper::$adminUser protected property User with privileges to do everything.
UbercartTestHelper::$customer protected property Authenticated but unprivileged user.
UbercartTestHelper::$product protected property Test product.
UbercartTestHelper::checkout function Executes the checkout process.
UbercartTestHelper::createProduct function Creates a new product.
UbercartTestHelper::createProductClass function
UbercartTestHelper::cronRun protected function Runs cron in the Drupal installed by Simpletest. Overrides DrupalWebTestCase::cronRun
UbercartTestHelper::findMail function Assert that an email was sent with a specific subject line.