File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
api-functional/testsuite/Magento/Sales/Service/V1
integration/testsuite/Magento/Sales/_files Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -36,4 +36,28 @@ public function testOrderCancel()
36
36
$ result = $ this ->_webApiCall ($ serviceInfo , $ requestData );
37
37
$ this ->assertTrue ($ result );
38
38
}
39
+
40
+ /**
41
+ * @magentoApiDataFixture Magento/Sales/_files/order_state_hold.php
42
+ */
43
+ public function testOrderWithStateHoldedShouldNotBeCanceled ()
44
+ {
45
+ $ objectManager = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ();
46
+ $ order = $ objectManager ->get (\Magento \Sales \Model \Order::class)->loadByIncrementId ('100000001 ' );
47
+ $ serviceInfo = [
48
+ 'rest ' => [
49
+ 'resourcePath ' => '/V1/orders/ ' . $ order ->getId () . '/cancel ' ,
50
+ 'httpMethod ' => \Magento \Framework \Webapi \Rest \Request::HTTP_METHOD_POST ,
51
+ ],
52
+ 'soap ' => [
53
+ 'service ' => self ::SERVICE_NAME ,
54
+ 'serviceVersion ' => self ::SERVICE_VERSION ,
55
+ 'operation ' => self ::SERVICE_NAME . 'cancel ' ,
56
+ ],
57
+ ];
58
+
59
+ $ requestData = ['id ' => $ order ->getId ()];
60
+ $ result = $ this ->_webApiCall ($ serviceInfo , $ requestData );
61
+ $ this ->assertFalse ($ result );
62
+ }
39
63
}
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+
7
+ use Magento \Sales \Model \Order ;
8
+
9
+ require 'order.php ' ;
10
+
11
+ /** @var Order $order */
12
+ $ order ->setState (Order::STATE_HOLDED );
13
+ $ order ->setStatus (Order::STATE_HOLDED );
14
+ $ order ->save ();
You can’t perform that action at this time.
0 commit comments