diff --git a/unit-tests/Tests/Version2/orders.php b/unit-tests/Tests/Version2/orders.php index 1837fc252d8..e80fbab5fb8 100644 --- a/unit-tests/Tests/Version2/orders.php +++ b/unit-tests/Tests/Version2/orders.php @@ -175,7 +175,8 @@ class WC_Tests_API_Orders_V2 extends WC_REST_Unit_Test_Case { array( 'method_id' => 'flat_rate', 'method_title' => 'Flat rate', - 'total' => '10', + 'total' => '10.00', + 'instance_id' => '1', ), ), ) @@ -208,6 +209,18 @@ class WC_Tests_API_Orders_V2 extends WC_REST_Unit_Test_Case { $this->assertEquals( $order->get_shipping_country(), $data['shipping']['country'] ); $this->assertEquals( 1, count( $data['line_items'] ) ); $this->assertEquals( 1, count( $data['shipping_lines'] ) ); + $shipping = current( $order->get_items( 'shipping' ) ); + $expected = array( + 'id' => $shipping->get_id(), + 'method_title' => $shipping->get_method_title(), + 'method_id' => $shipping->get_method_id(), + 'instance_id' => $shipping->get_instance_id(), + 'total' => wc_format_decimal( $shipping->get_total(), '' ), + 'total_tax' => wc_format_decimal( $shipping->get_total_tax(), '' ), + 'taxes' => array(), + 'meta_data' => $shipping->get_meta_data(), + ); + $this->assertEquals( $expected, $data['shipping_lines'][0] ); } /** diff --git a/unit-tests/Tests/Version3/orders.php b/unit-tests/Tests/Version3/orders.php index d778ba0a39d..eb7b057c9e6 100644 --- a/unit-tests/Tests/Version3/orders.php +++ b/unit-tests/Tests/Version3/orders.php @@ -179,7 +179,8 @@ class WC_Tests_API_Orders extends WC_REST_Unit_Test_Case { array( 'method_id' => 'flat_rate', 'method_title' => 'Flat rate', - 'total' => '10', + 'total' => '10.00', + 'instance_id' => '1', ), ), ) @@ -212,6 +213,18 @@ class WC_Tests_API_Orders extends WC_REST_Unit_Test_Case { $this->assertEquals( $order->get_shipping_country(), $data['shipping']['country'] ); $this->assertEquals( 1, count( $data['line_items'] ) ); $this->assertEquals( 1, count( $data['shipping_lines'] ) ); + $shipping = current( $order->get_items( 'shipping' ) ); + $expected = array( + 'id' => $shipping->get_id(), + 'method_title' => $shipping->get_method_title(), + 'method_id' => $shipping->get_method_id(), + 'instance_id' => $shipping->get_instance_id(), + 'total' => wc_format_decimal( $shipping->get_total(), '' ), + 'total_tax' => wc_format_decimal( $shipping->get_total_tax(), '' ), + 'taxes' => array(), + 'meta_data' => $shipping->get_meta_data(), + ); + $this->assertEquals( $expected, $data['shipping_lines'][0] ); } /**