From 185675c69ef14fa326dbd01443231210c0b2e0ac Mon Sep 17 00:00:00 2001 From: Peter Fabian Date: Thu, 7 Jun 2018 14:58:53 +0200 Subject: [PATCH] Added unit test to cover the orders/refund_id. --- tests/unit-tests/api/orders.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/unit-tests/api/orders.php b/tests/unit-tests/api/orders.php index 5b493d71004..cb9b1bddda0 100644 --- a/tests/unit-tests/api/orders.php +++ b/tests/unit-tests/api/orders.php @@ -114,6 +114,20 @@ class WC_Tests_API_Orders extends WC_REST_Unit_Test_Case { $this->assertEquals( 404, $response->get_status() ); } + /** + * Tests getting an order with an invalid ID. + * @since 3.4.3 + */ + public function test_get_item_refund_id() { + wp_set_current_user( $this->user ); + $order = WC_Helper_Order::create_order(); + $refund = wc_create_refund( array( + 'order_id' => $order->get_id(), + ) ); + $response = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v2/orders/' . $refund->get_id() ) ); + $this->assertEquals( 404, $response->get_status() ); + } + /** * Tests creating an order. * @since 3.0.0