private function CommerceInvoiceTestCase::addLineItemToOrder in Commerce Invoice 7.2
Adds a line item with 10 $50 worth products.
Parameters
object $order: A Commerce Order object.
2 calls to CommerceInvoiceTestCase::addLineItemToOrder()
- CommerceInvoiceTestCase::testInvoiceCreationAndPayment in tests/
commerce_invoice.test - Tests creation and payment of an Invoice.
- CommerceInvoiceTestCase::testOrderUpdateWithPendingInvoices in tests/
commerce_invoice.test - Tests invoice behavior when orders were updated prior to payment.
File
- tests/
commerce_invoice.test, line 129 - Functional tests for the commerce invoice module.
Class
- CommerceInvoiceTestCase
- Test commerce invoices.
Code
private function addLineItemToOrder($order) {
$order_wrapper = entity_metadata_wrapper('commerce_order', $order);
$line_item = commerce_product_line_item_new($this->product50, 10, $order->order_id);
commerce_line_item_save($line_item);
$order_wrapper->commerce_line_items[] = $line_item;
$order_wrapper
->save();
}