Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
OrderStatusHistoryAddTest.php
Go to the documentation of this file.
1 <?php
8 
11 
17 {
18  const SERVICE_READ_NAME = 'salesOrderManagementV1';
19 
20  const SERVICE_VERSION = 'V1';
21 
22  const ORDER_INCREMENT_ID = '100000001';
23 
27  protected $objectManager;
28 
29  protected function setUp()
30  {
32  }
33 
38  public function testOrderCommentAdd()
39  {
41  $order = $this->objectManager->create(\Magento\Sales\Model\Order::class);
42  $order->loadByIncrementId(self::ORDER_INCREMENT_ID);
43 
44  $commentData = [
53  ];
54 
55  $requestData = ['id' => $order->getId(), 'statusHistory' => $commentData];
56  $serviceInfo = [
57  'rest' => [
58  'resourcePath' => '/V1/orders/' . $order->getId() . '/comments',
60  ],
61  'soap' => [
62  'service' => self::SERVICE_READ_NAME,
63  'serviceVersion' => self::SERVICE_VERSION,
64  'operation' => self::SERVICE_READ_NAME . 'addComment',
65  ],
66  ];
67 
68  $this->_webApiCall($serviceInfo, $requestData);
69 
70  //Verification
71  $comments = $order->load($order->getId())->getAllStatusHistory();
72 
73  $commentData = reset($comments);
74  foreach ($commentData as $key => $value) {
75  $this->assertEquals(
77  $statusHistoryComment->getComment()
78  );
79  $this->assertEquals(
81  $statusHistoryComment->getParentId()
82  );
83  $this->assertEquals(
85  $statusHistoryComment->getIsCustomerNotified()
86  );
87  $this->assertEquals(
89  $statusHistoryComment->getIsVisibleOnFront()
90  );
91  }
92  }
93 }
_webApiCall( $serviceInfo, $arguments=[], $webApiAdapterCode=null, $storeCode=null, $integration=null)
$order
Definition: order.php:55
$value
Definition: gender.phtml:16