Skip to content

Commit 3628a78

Browse files
committed
Merge branch 'ACP2E-1943' of https://github.com/magento-l3/magento2ce into PR-05242023
2 parents 737cc14 + 1ba3de3 commit 3628a78

File tree

2 files changed

+6
-15
lines changed
  • app/code/Magento/CatalogInventory

2 files changed

+6
-15
lines changed

app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/StockItem.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ class StockItem
3535

3636
/**
3737
* @var StockStateProviderInterface
38+
* @deprecated
39+
* @see was overriding ItemBackorders value with the Default Scope value; caused discrepancy in multistock config
3840
*/
3941
private $stockStateProvider;
4042

@@ -122,11 +124,6 @@ public function initialize(
122124
$quoteItem->setHasError(true);
123125
}
124126

125-
/* We need to ensure that any possible plugin will not erase the data */
126-
$backOrdersQty = $this->stockStateProvider->checkQuoteItemQty($stockItem, $rowQty, $qtyForCheck, $qty)
127-
->getItemBackorders();
128-
$result->setItemBackorders($backOrdersQty);
129-
130127
if ($stockItem->hasIsChildItem()) {
131128
$stockItem->unsIsChildItem();
132129
}

app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/StockItemTest.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,7 @@ public function testInitializeWithSubitem()
173173
->method('checkQuoteItemQty')
174174
->withAnyParameters()
175175
->willReturn($result);
176-
$this->stockStateProviderMock->expects($this->once())
177-
->method('checkQuoteItemQty')
178-
->withAnyParameters()
179-
->willReturn($result);
176+
$this->stockStateProviderMock->expects($this->never())->method('checkQuoteItemQty');
180177
$product->expects($this->once())
181178
->method('getCustomOption')
182179
->with('product_type')
@@ -213,7 +210,7 @@ public function testInitializeWithSubitem()
213210
$quoteItem->expects($this->once())->method('setUseOldQty')->with('item')->willReturnSelf();
214211
$result->expects($this->exactly(2))->method('getMessage')->willReturn('message');
215212
$quoteItem->expects($this->once())->method('setMessage')->with('message')->willReturnSelf();
216-
$result->expects($this->exactly(3))->method('getItemBackorders')->willReturn('backorders');
213+
$result->expects($this->exactly(2))->method('getItemBackorders')->willReturn('backorders');
217214
$quoteItem->expects($this->once())->method('setBackorders')->with('backorders')->willReturnSelf();
218215
$quoteItem->expects($this->once())->method('setStockStateResult')->with($result)->willReturnSelf();
219216

@@ -276,10 +273,7 @@ public function testInitializeWithoutSubitem()
276273
->method('checkQuoteItemQty')
277274
->withAnyParameters()
278275
->willReturn($result);
279-
$this->stockStateProviderMock->expects($this->once())
280-
->method('checkQuoteItemQty')
281-
->withAnyParameters()
282-
->willReturn($result);
276+
$this->stockStateProviderMock->expects($this->never())->method('checkQuoteItemQty');
283277
$product->expects($this->once())
284278
->method('getCustomOption')
285279
->with('product_type')
@@ -299,7 +293,7 @@ public function testInitializeWithoutSubitem()
299293
$result->expects($this->once())->method('getHasQtyOptionUpdate')->willReturn(false);
300294
$result->expects($this->once())->method('getItemUseOldQty')->willReturn(null);
301295
$result->expects($this->once())->method('getMessage')->willReturn(null);
302-
$result->expects($this->exactly(2))->method('getItemBackorders')->willReturn(null);
296+
$result->expects($this->exactly(1))->method('getItemBackorders')->willReturn(null);
303297

304298
$this->model->initialize($stockItem, $quoteItem, $qty);
305299
}

0 commit comments

Comments
 (0)