61 $this->objectManagerHelper =
new ObjectManagerHelper($this);
63 $this->stock = $this->createMock(\
Magento\CatalogInventory\Api\Data\StockInterface::class);
64 $this->stockItem = $this->createMock(\
Magento\CatalogInventory\Api\Data\StockItemInterface::class);
65 $this->stockStatus = $this->createMock(\
Magento\CatalogInventory\Api\Data\StockStatusInterface::class);
66 $this->objectResult = $this->createMock(\
Magento\Framework\DataObject::class);
68 $this->stockStateProvider = $this->createPartialMock(
69 \
Magento\CatalogInventory\Model\Spi\StockStateProviderInterface::class,
80 $this->stockStateProvider->expects($this->any())->method(
'verifyStock')->willReturn(
true);
81 $this->stockStateProvider->expects($this->any())->method(
'verifyNotification')->willReturn(
true);
82 $this->stockStateProvider->expects($this->any())->method(
'checkQty')->willReturn(
true);
83 $this->stockStateProvider->expects($this->any())->method(
'suggestQty')->willReturn($this->qty);
84 $this->stockStateProvider->expects($this->any())->method(
'getStockQty')->willReturn($this->qty);
85 $this->stockStateProvider->expects($this->any())->method(
'checkQtyIncrements')->willReturn($this->objectResult);
86 $this->stockStateProvider->expects($this->any())->method(
'checkQuoteItemQty')->willReturn($this->objectResult);
88 $this->stockRegistryProvider = $this->createPartialMock(
89 \
Magento\CatalogInventory\Model\Spi\StockRegistryProviderInterface::class,
90 [
'getStock',
'getStockItem',
'getStockStatus']
92 $this->stockRegistryProvider->expects($this->any())
94 ->will($this->returnValue($this->stock));
95 $this->stockRegistryProvider->expects($this->any())
96 ->method(
'getStockItem')
97 ->will($this->returnValue($this->stockItem));
98 $this->stockRegistryProvider->expects($this->any())
99 ->method(
'getStockStatus')
100 ->will($this->returnValue($this->stockStatus));
102 $this->stockState = $this->objectManagerHelper->getObject(
103 \
Magento\CatalogInventory\Model\StockState::class,
105 'stockStateProvider' => $this->stockStateProvider,
106 'stockRegistryProvider' => $this->stockRegistryProvider
113 $this->stockState =
null;
120 $this->stockState->verifyStock($this->productId, $this->websiteId)
128 $this->stockState->verifyNotification($this->productId, $this->websiteId)
136 $this->stockState->checkQty($this->productId, $this->qty, $this->websiteId)
144 $this->stockState->suggestQty($this->productId, $this->qty, $this->websiteId)
152 $this->stockState->getStockQty($this->productId, $this->websiteId)
160 $this->stockState->checkQtyIncrements($this->productId, $this->qty, $this->websiteId)
168 $this->stockState->checkQuoteItemQty(