diff --git a/app/code/Magento/InventorySales/Test/Integration/IsProductSalableForRequestedQty/IsCorrectQtyConditionTest.php b/app/code/Magento/InventorySales/Test/Integration/IsProductSalableForRequestedQty/IsCorrectQtyConditionTest.php index e81661aa5ac72..37ff9fd33414a 100644 --- a/app/code/Magento/InventorySales/Test/Integration/IsProductSalableForRequestedQty/IsCorrectQtyConditionTest.php +++ b/app/code/Magento/InventorySales/Test/Integration/IsProductSalableForRequestedQty/IsCorrectQtyConditionTest.php @@ -14,6 +14,9 @@ use Magento\TestFramework\Helper\Bootstrap; use PHPUnit\Framework\TestCase; +/** + * @magentoAppIsolation enabled + */ class IsCorrectQtyConditionTest extends TestCase { /** @@ -326,6 +329,68 @@ public function executeWithMaxSaleQtyDataProvider(): array ]; } + /** + * @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/products.php + * @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/sources.php + * @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/stocks.php + * @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/source_items.php + * @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/stock_source_links.php + * @magentoDataFixture ../../../../app/code/Magento/InventoryIndexer/Test/_files/reindex_inventory.php + * @magentoConfigFixture current_store cataloginventory/item_options/enable_qty_increments 1 + * @magentoConfigFixture current_store cataloginventory/item_options/qty_increments 3 + * + * @param string $sku + * @param int $stockId + * @param int $requestedQty + * @param bool $expectedResult + * + * @return void + * + * @dataProvider executeWithUseConfigQtyIncrementsDataProvider + */ + public function testExecuteWithUseConfigQtyIncrements( + string $sku, + int $stockId, + int $requestedQty, + bool $expectedResult + ): void { + $result = $this->isProductSalableForRequestedQty->execute($sku, $stockId, $requestedQty); + $this->assertEquals($expectedResult, $result->isSalable()); + } + + /** + * @return array + */ + public function executeWithUseConfigQtyIncrementsDataProvider(): array + { + return [ + ['SKU-1', 10, 1, false], + ['SKU-1', 10, 3, true], + ['SKU-1', 10, 6, true], + ['SKU-1', 10, 9, false], + ['SKU-2', 10, 1, false], + ['SKU-2', 10, 3, false], + ['SKU-3', 10, 1, false], + ['SKU-3', 10, 3, false], + ['SKU-1', 20, 1, false], + ['SKU-1', 20, 3, false], + ['SKU-2', 20, 1, false], + ['SKU-2', 20, 3, true], + ['SKU-2', 20, 6, false], + ['SKU-3', 20, 1, false], + ['SKU-3', 20, 3, false], + ['SKU-1', 30, 1, false], + ['SKU-1', 30, 3, true], + ['SKU-1', 30, 6, true], + ['SKU-1', 30, 9, false], + ['SKU-2', 30, 1, false], + ['SKU-2', 30, 3, true], + ['SKU-2', 30, 6, false], + ['SKU-3', 30, 1, false], + ['SKU-3', 30, 3, false], + ]; + } + /** * @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/products.php * @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/sources.php