You are here

protected function CommerceReportsPatternsTestCase::addTransaction in Commerce Reporting 7.4

Same name and namespace in other branches
  1. 7.3 modules/patterns/tests/commerce_reports_patterns.test \CommerceReportsPatternsTestCase::addTransaction()
1 call to CommerceReportsPatternsTestCase::addTransaction()
CommerceReportsPatternsTestCase::testExample in modules/patterns/tests/commerce_reports_patterns.test

File

modules/patterns/tests/commerce_reports_patterns.test, line 25

Class

CommerceReportsPatternsTestCase

Code

protected function addTransaction() {
  $products = func_get_args();
  $order = commerce_cart_order_new(1);
  $order_wrapper = entity_metadata_wrapper('commerce_order', $order);
  $line_items = array();
  foreach ($products as $product) {
    $line_item = commerce_product_line_item_new($product, 1);
    $line_item->order_id = $order->order_id;
    commerce_line_item_save($line_item);
    $order_wrapper->commerce_line_items[] = $line_item;
  }
  commerce_order_status_update($order, 'completed', TRUE);
  commerce_order_save($order);
  return $order;
}