/** * Retrieve Minimum Qty Allowed in Shopping Cart or NULL when there is no limitation * * @return float|null */ public function getMinSaleQty() { $customerGroupId = $this->getCustomerGroupId(); if (!isset($this->_minSaleQtyCache[$customerGroupId])) { if ($this->getUseConfigMinSaleQty()) { $minSaleQty = $this->_catalogInventoryMinsaleqty->getConfigValue($customerGroupId); } else { $minSaleQty = $this->getData('min_sale_qty'); } $this->_minSaleQtyCache[$customerGroupId] = empty($minSaleQty) ? 0 : (double) $minSaleQty; } return $this->_minSaleQtyCache[$customerGroupId] ? $this->_minSaleQtyCache[$customerGroupId] : null; }
/** * @param int $customerGroupId * @param int|null $store * @param float $minSaleQty * @param float|null $result * @dataProvider getConfigValueDataProvider */ public function testGetConfigValue($customerGroupId, $store, $minSaleQty, $result) { $this->scopeConfigMock->expects($this->once())->method('getValue')->with($this->equalTo(\Magento\CatalogInventory\Model\Configuration::XML_PATH_MIN_SALE_QTY), $this->equalTo(\Magento\Framework\Store\ScopeInterface::SCOPE_STORE), $this->equalTo($store))->will($this->returnValue($minSaleQty)); $this->assertSame($result, $this->minsaleqty->getConfigValue($customerGroupId, $store)); }
/** * @param null|string|bool|int|\Magento\Store\Model\Store $store * @param int $customerGroupId * @return float */ public function getMinSaleQty($store = null, $customerGroupId = null) { return (double) $this->minsaleqtyHelper->getConfigValue($customerGroupId, $store); }