protected function MonitoringCommerceTest::createEmptyOrderWithPrice in Monitoring 7
Create an order for testing purposes.
The value of the total amount of the resulting order will be 1 (100 in db).
Parameters
string $status: Status in which the order should be created.
string $currency: Currency of the total amount.
2 calls to MonitoringCommerceTest::createEmptyOrderWithPrice()
- MonitoringCommerceTest::testOrderStatusSensors in test/
tests/ monitoring.commerce.test - Test commerce order count sensors with different order status.
- MonitoringCommerceTest::testTurnoverSensors in test/
tests/ monitoring.commerce.test - Test commerce turnover sensors.
File
- test/
tests/ monitoring.commerce.test, line 116 - Contains \MonitoringCommerceTest.
Class
- MonitoringCommerceTest
- Tests for commerce order turnover sensor.
Code
protected function createEmptyOrderWithPrice($status, $currency = 'CHF', $amount = 100) {
$order = commerce_order_new(0, $status);
commerce_order_save($order);
// Make life easier to directly update the total so we do not need to
// create line items.
db_update('field_data_commerce_order_total')
->fields(array(
'commerce_order_total_amount' => $amount,
'commerce_order_total_currency_code' => $currency,
))
->condition('entity_id', $order->order_id)
->execute();
}