Skip to content

Commit a209d18

Browse files
anzinkaryna-t
authored andcommitted
Fixed Integration Test CreateShipmentForOrderTest
1 parent 2bd7f76 commit a209d18

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

app/code/Magento/Sales/Model/Order/ShipmentFactory.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,6 @@ protected function prepareItems(
136136
}
137137
} else {
138138
if (isset($items[$orderItem->getId()])) {
139-
if (!is_numeric($items[$orderItem->getId()])) {
140-
throw new \Magento\Framework\Exception\LocalizedException(
141-
__('The specified qty is not valid.')
142-
);
143-
}
144-
145139
$qty = min($items[$orderItem->getId()], $orderItem->getQtyToShip());
146140
} elseif (!count($items)) {
147141
$qty = $orderItem->getQtyToShip();
@@ -171,7 +165,7 @@ private function validateItem(\Magento\Sales\Model\Order\Item $orderItem, array
171165

172166
// Remove from shipment items without qty or with qty=0
173167
if (!$orderItem->isDummy(true)
174-
&& (!isset($items[$orderItem->getId()]) || $items[$orderItem->getId()] <= 0)
168+
&& (!isset($items[$orderItem->getId()]) || (int) $items[$orderItem->getId()] <= 0)
175169
) {
176170
return false;
177171
}

dev/tests/integration/testsuite/Magento/Shipping/Controller/Adminhtml/Order/Shipment/Save/CreateShipmentForOrderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ public function testCreateOrderShipmentWithAlphabetQty(): void
234234
$postData = $this->createPostData($dataToSend);
235235
$this->performShipmentCreationRequest($postData);
236236
$this->assertCreateShipmentRequestWithError(
237-
"The specified qty is not valid.",
237+
"Shipment Document Validation Error(s):\nYou can't create a shipment without products.",
238238
"admin/order_shipment/new/order_id/{$postData['order_id']}"
239239
);
240240
}

0 commit comments

Comments
 (0)