/**
  * Check quantity
  *
  * @param int $productId
  * @param float $qty
  * @param int $scopeId
  * @exception \Magento\Framework\Exception\LocalizedException
  * @return bool
  */
 public function checkQty($productId, $qty, $scopeId = null)
 {
     if ($scopeId === null) {
         $scopeId = $this->stockConfiguration->getDefaultScopeId();
     }
     $stockItem = $this->stockRegistryProvider->getStockItem($productId, $scopeId);
     return $this->stockStateProvider->checkQty($stockItem, $qty);
 }
Beispiel #2
0
 /**
  * @param StockItemInterface $stockItem
  * @param mixed $expectedResult
  * @dataProvider checkQtyDataProvider
  */
 public function testCheckQty(StockItemInterface $stockItem, $expectedResult)
 {
     $this->assertEquals($expectedResult, $this->stockStateProvider->checkQty($stockItem, $this->qty));
 }