You are here

public function CommerceAjaxAddCartUI::setUp in Commerce Ajax Add to Cart 7.2

Implementation of setUp().

Overrides DrupalWebTestCase::setUp

File

tests/dc_ajax_add_cart_ui.test, line 113
Functional tests for commerce ajax add to cart module.

Class

CommerceAjaxAddCartUI
Functional tests for commerce ajax add to cart module.

Code

public function setUp() {
  $modules = parent::setUpHelper('all');
  $this->product = array();
  $this->productNode = array();

  // Create a dummy product display content type.
  $this
    ->createDummyProductDisplayContentType();

  // Create dummy product display nodes (and their corresponding product
  // entities).
  for ($i = 0; $i <= 9; $i++) {
    $sku = "PROD-{$i}";
    $product_name = "Product {$i}";
    $this->product[$i] = $this
      ->createDummyProduct($sku, $product_name);
    $this->productNode[$i] = $this
      ->createDummyProductNode(array(
      $this->product[$i]->product_id,
    ), $product_name);
  }

  // Place the blocks.
  $this
    ->drupalLogin($this->storeAdmin);
  $this
    ->drupalGet('admin/structure/block');
  $edit = array();
  $edit['blocks[dc_ajax_add_cart_ajax_shopping_cart][region]'] = 'featured';
  $edit['blocks[dc_ajax_add_cart_ajax_shopping_cart_teaser][region]'] = 'sidebar_first';
  $this
    ->drupalPost('admin/structure/block', $edit, t('Save blocks'));
  $this
    ->drupalLogout();
}