Skip to content

Commit 096522e

Browse files
committed
Merge branch 'MC-43163' of https://github.com/magento-l3/magento2ce into L3-PR-20211001
2 parents 4655cf2 + b36ecea commit 096522e

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

app/code/Magento/Sales/Model/ResourceModel/EntityAbstract.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,9 @@ protected function updateObject(\Magento\Framework\Model\AbstractModel $object)
179179
$condition = $this->getConnection()->quoteInto($this->getIdFieldName() . '=?', $object->getId());
180180
$data = $this->_prepareDataForSave($object);
181181
unset($data[$this->getIdFieldName()]);
182-
$this->getConnection()->update($this->getMainTable(), $data, $condition);
182+
if (count($data) > 0) {
183+
$this->getConnection()->update($this->getMainTable(), $data, $condition);
184+
}
183185
}
184186

185187
/**

dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderUpdateTest.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,47 @@ public function testOrderStatusUpdate()
167167
);
168168
}
169169

170+
/**
171+
* Check order increment id after updating via webapi
172+
*
173+
* @magentoApiDataFixture Magento/Sales/_files/order.php
174+
*/
175+
public function testOrderNoAttributesProvidedUpdate()
176+
{
177+
/** @var Order $order */
178+
$order = $this->objectManager->get(Order::class)
179+
->loadByIncrementId(self::ORDER_INCREMENT_ID);
180+
181+
$entityData = $this->getOrderData($order);
182+
if (TESTS_WEB_API_ADAPTER == self::ADAPTER_SOAP) {
183+
$this->markTestSkipped("Soap calls are more strict and contains attributes.");
184+
return;
185+
}
186+
187+
$requestData = ['entity' => ['entity_id' => $entityData['entity_id']]];
188+
189+
$serviceInfo = [
190+
'rest' => [
191+
'resourcePath' => '/V1/orders',
192+
'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST,
193+
],
194+
'soap' => [
195+
'service' => self::SERVICE_NAME,
196+
'serviceVersion' => self::SERVICE_VERSION,
197+
'operation' => self::SERVICE_NAME . 'save',
198+
],
199+
];
200+
$result = $this->_webApiCall($serviceInfo, $requestData);
201+
$this->assertGreaterThan(1, count($result));
202+
203+
/** @var Order $actualOrder */
204+
$actualOrder = $this->objectManager->get(Order::class)->load($order->getId());
205+
$this->assertEquals(
206+
$order->getData(OrderInterface::INCREMENT_ID),
207+
$actualOrder->getData(OrderInterface::INCREMENT_ID)
208+
);
209+
}
210+
170211
/**
171212
* Prepare order data for request
172213
*

0 commit comments

Comments
 (0)