Skip to content

Commit

Permalink
Fixed unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiosanches committed Sep 11, 2018
1 parent 8d9da1c commit d4b1089
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/unit-tests/api/orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,26 +340,26 @@ public function test_update_order_remove_items() {
*/
public function test_update_order_add_coupons() {
wp_set_current_user( $this->user );

$order = WC_Helper_Order::create_order();
$order_item = current( $order->get_items() );
$coupon = WC_Helper_Coupon::create_coupon( 'fake-coupon' );
$coupon->set_amount( 5 );
$coupon->save();

$request = new WP_REST_Request( 'PUT', '/wc/v3/orders/' . $order->get_id() );
$request->set_body_params(
array(
'coupon_lines' => array(
array(
'code' => 'fake-coupon',
'discount_total' => '5',
'discount_tax' => '0',
),
),
'line_items' => array(
array(
'id' => $order_item->get_id(),
'product_id' => $order_item->get_product_id(),
'total' => '35.00',
'subtotal' => '35.00',
),
),
'coupon_lines' => array(
array(
'code' => 'fake-coupon',
),
),
)
Expand Down

0 comments on commit d4b1089

Please sign in to comment.