You are here

function CommerceCartTestCaseMultiProducts::setUp in Commerce Core 7

Implementation of setUp().

Overrides DrupalWebTestCase::setUp

File

modules/cart/tests/commerce_cart.test, line 205
Functional tests for the commerce cart module.

Class

CommerceCartTestCaseMultiProducts
Test cart features for a product display that has several products attached.

Code

function setUp() {
  parent::setUpHelper('all');

  // Create a dummy product display content type.
  $this
    ->createDummyProductDisplayContentType('product_display', TRUE, 'field_product', 2);

  // Create dummy product display nodes (and their corresponding product
  //  entities).
  $products = array();
  $sku = 'PROD-01';
  $product_name = 'Product One';
  $this->product_titles[] = $product_name;
  $product = $this
    ->createDummyProduct($sku, $product_name);
  $this->products[$product->product_id] = $product;
  $sku = 'PROD-02';
  $product_name = 'Product Two';
  $this->product_titles[] = $product_name;
  $product = $this
    ->createDummyProduct($sku, $product_name);
  $this->products[$product->product_id] = $product;
  $this->product_node = $this
    ->createDummyProductNode(array_keys($this->products), 'Combined Product');

  // Log as a normal user to test cart process.
  $this
    ->drupalLogin($this->store_customer);

  // Submit the add to cart form.
  $this
    ->drupalPost('node/' . $this->product_node->nid, array(
    'product_id' => $this->products[2]->product_id,
  ), t('Add to cart'));
}