From 746038efe9fd49d0eb2c1f0349100d80f9ac4d10 Mon Sep 17 00:00:00 2001 From: Roman Strilenko Date: Sat, 21 Sep 2019 13:46:48 +0200 Subject: [PATCH 1/2] #878 - Deprecated the column increment_id - Added new column order_number with the type of String! - Changed the api_functional test in order to test a new field --- .../SalesGraphQl/Model/Resolver/Orders.php | 1 + .../Magento/SalesGraphQl/etc/schema.graphqls | 3 ++- .../Magento/GraphQl/Sales/OrdersTest.php | 20 +++++++++---------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/code/Magento/SalesGraphQl/Model/Resolver/Orders.php b/app/code/Magento/SalesGraphQl/Model/Resolver/Orders.php index 4fd06e88878b..8d81afeab4c9 100644 --- a/app/code/Magento/SalesGraphQl/Model/Resolver/Orders.php +++ b/app/code/Magento/SalesGraphQl/Model/Resolver/Orders.php @@ -56,6 +56,7 @@ public function resolve( $items[] = [ 'id' => $order->getId(), 'increment_id' => $order->getIncrementId(), + 'order_number' => $order->getIncrementId(), 'created_at' => $order->getCreatedAt(), 'grand_total' => $order->getGrandTotal(), 'status' => $order->getStatus(), diff --git a/app/code/Magento/SalesGraphQl/etc/schema.graphqls b/app/code/Magento/SalesGraphQl/etc/schema.graphqls index 06146f805c64..a7c30f582e75 100644 --- a/app/code/Magento/SalesGraphQl/etc/schema.graphqls +++ b/app/code/Magento/SalesGraphQl/etc/schema.graphqls @@ -7,7 +7,8 @@ type Query { type CustomerOrder @doc(description: "Order mapping fields") { id: Int - increment_id: String + increment_id: String @deprecated(reason: "Use the order_number instaed.") + order_number: String! @doc(description: "The order number") created_at: String grand_total: Float status: String diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Sales/OrdersTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Sales/OrdersTest.php index 9c969befa328..cffbf808f805 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Sales/OrdersTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Sales/OrdersTest.php @@ -38,9 +38,7 @@ public function testOrdersQuery() query { customerOrders { items { - id - increment_id - created_at + order_number grand_total status } @@ -54,27 +52,27 @@ public function testOrdersQuery() $expectedData = [ [ - 'increment_id' => '100000002', + 'order_number' => '100000002', 'status' => 'processing', 'grand_total' => 120.00 ], [ - 'increment_id' => '100000003', + 'order_number' => '100000003', 'status' => 'processing', 'grand_total' => 130.00 ], [ - 'increment_id' => '100000004', + 'order_number' => '100000004', 'status' => 'closed', 'grand_total' => 140.00 ], [ - 'increment_id' => '100000005', + 'order_number' => '100000005', 'status' => 'complete', 'grand_total' => 150.00 ], [ - 'increment_id' => '100000006', + 'order_number' => '100000006', 'status' => 'complete', 'grand_total' => 160.00 ] @@ -84,9 +82,9 @@ public function testOrdersQuery() foreach ($expectedData as $key => $data) { $this->assertEquals( - $data['increment_id'], - $actualData[$key]['increment_id'], - "increment_id is different than the expected for order - " . $data['increment_id'] + $data['order_number'], + $actualData[$key]['order_number'], + "order_number is different than the expected for order - " . $data['order_number'] ); $this->assertEquals( $data['grand_total'], From 225c9f720d28c1d1ce077c333042a112dac0dd51 Mon Sep 17 00:00:00 2001 From: Roman Strilenko Date: Sat, 21 Sep 2019 14:55:23 +0200 Subject: [PATCH 2/2] #878 - fixed api - functional test --- .../testsuite/Magento/GraphQl/Sales/OrdersTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Sales/OrdersTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Sales/OrdersTest.php index cffbf808f805..11a2216b6668 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Sales/OrdersTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Sales/OrdersTest.php @@ -89,12 +89,12 @@ public function testOrdersQuery() $this->assertEquals( $data['grand_total'], $actualData[$key]['grand_total'], - "grand_total is different than the expected for order - " . $data['increment_id'] + "grand_total is different than the expected for order - " . $data['order_number'] ); $this->assertEquals( $data['status'], $actualData[$key]['status'], - "status is different than the expected for order - " . $data['increment_id'] + "status is different than the expected for order - " . $data['order_number'] ); } }