6 declare(strict_types=1);
15 use PHPUnit\Framework\TestCase;
22 private $isProductSalableForRequestedQty;
27 private $getStockItemConfiguration;
32 private $saveStockItemConfiguration;
41 IsProductSalableForRequestedQtyInterface::class
44 GetStockItemConfigurationInterface::class
47 SaveStockItemConfigurationInterface::class
68 $stockItemConfiguration = $this->getStockItemConfiguration->execute($sku, $stockId);
69 $stockItemConfiguration->setUseConfigBackorders(
false);
71 $stockItemConfiguration->setUseConfigMinQty(
false);
72 $stockItemConfiguration->setMinQty($minQty);
73 $this->saveStockItemConfiguration->execute($sku, $stockId, $stockItemConfiguration);
77 $this->isProductSalableForRequestedQty->execute($sku, $stockId, $requestedQty)->isSalable()
84 'salable_qty' => [
'SKU-1', 10, -4.5, 13,
true],
85 'not_salable_qty' => [
'SKU-1', 10, -4.5, 14,
false],
107 $stockItemConfiguration = $this->getStockItemConfiguration->execute($sku, $stockId);
108 $stockItemConfiguration->setUseConfigBackorders(
true);
109 $stockItemConfiguration->setUseConfigMinQty(
true);
110 $this->saveStockItemConfiguration->execute($sku, $stockId, $stockItemConfiguration);
114 $this->isProductSalableForRequestedQty->execute($sku, $stockId, $requestedQty)->isSalable()
121 'salable_qty' => [
'SKU-1', 10, 13,
true],
122 'not_salable_qty' => [
'SKU-1', 10, 14,
false],
isProductSalableForRequestedQtyWithBackordersEnabledAtProductLevelDataProvider()
const BACKORDERS_YES_NONOTIFY
testIsProductSalableForRequestedQtyWithBackordersEnabledGlobally( $sku, $stockId, $requestedQty, $expectedSalability)
testIsProductSalableForRequestedQtyWithBackordersEnabledAtProductLevel( $sku, $stockId, $minQty, $requestedQty, $expectedSalability)
isProductSalableForRequestedQtyWithBackordersEnabledGloballyDataProvider()
static getObjectManager()