Skip to content

Commit f97e92e

Browse files
committed
MCP-602: Fix failed MFTF test
- Fix AdminNotAvailableProductQtyInShoppingCartValidationTest
1 parent d883c74 commit f97e92e

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

app/code/Magento/Quote/Model/Quote/Item/AbstractItem.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,17 +318,16 @@ public function getStore()
318318
}
319319

320320
/**
321-
* Checking item data
321+
* Set and Validate Item Qty
322322
*
323-
* @return $this
323+
* @return void
324324
*/
325-
public function checkData()
325+
public function setQuantity()
326326
{
327327
$this->setHasError(false);
328328
$this->clearMessage();
329329

330330
$qty = $this->_getData('qty');
331-
332331
try {
333332
$this->setQty($qty);
334333
} catch (\Magento\Framework\Exception\LocalizedException $e) {
@@ -338,7 +337,16 @@ public function checkData()
338337
$this->setHasError(true);
339338
$this->setMessage(__('Item qty declaration error'));
340339
}
340+
}
341341

342+
/**
343+
* Checking item data
344+
*
345+
* @return $this
346+
*/
347+
public function checkData()
348+
{
349+
$this->setQuantity();
342350
try {
343351
$this->getProduct()->getTypeInstance()->checkProductBuyState($this->getProduct());
344352
} catch (\Magento\Framework\Exception\LocalizedException $e) {

app/code/Magento/Quote/Model/ResourceModel/Quote/Item/Collection.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,8 @@ protected function _assignProducts(): self
293293
$item->setQtyOptions($qtyOptions)->setProduct($product);
294294
if ($this->config->isEnabled()) {
295295
$item->checkData();
296+
} else {
297+
$item->setQuantity();
296298
}
297299
}
298300
}

0 commit comments

Comments
 (0)