Skip to content

Commit

Permalink
Merge pull request magento#1025 from magento-engcom/724
Browse files Browse the repository at this point in the history
MSI-724: Implement IsCorrectQtyConditionTest::testExecuteWithQtyIncrements
  • Loading branch information
maghamed authored May 3, 2018
2 parents 93a93f6 + 3575780 commit 1bad503
Showing 1 changed file with 59 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,65 @@ public function executeWithMaxSaleQtyDataProvider(): array
];
}

public function testExecuteWithQtyIncrements()
/**
* @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
*
* @param string $sku
* @param int $stockId
* @param int $requestedQty
* @param bool $expectedResult
*
* @return void
*
* @dataProvider executeWithQtyIncrementsDataProvider
*/
public function testExecuteWithQtyIncrements(
string $sku,
int $stockId,
int $requestedQty,
bool $expectedResult
): void {
/** @var StockItemConfigurationInterface $stockItemConfiguration */
$stockItemConfiguration = $this->getStockItemConfiguration->execute($sku, $stockId);
$stockItemConfiguration->setUseConfigEnableQtyInc(false);
$stockItemConfiguration->setEnableQtyIncrements(true);
$stockItemConfiguration->setUseConfigQtyIncrements(false);
$stockItemConfiguration->setQtyIncrements(3);
$this->saveStockItemConfiguration->execute($sku, $stockId, $stockItemConfiguration);

$result = $this->isProductSalableForRequestedQty->execute($sku, $stockId, $requestedQty);
$this->assertEquals($expectedResult, $result->isSalable());
}

/**
* @return array
*/
public function executeWithQtyIncrementsDataProvider(): array
{
$this->markTestIncomplete('Still to implement');
return [
['SKU-1', 10, 1, false],
['SKU-1', 10, 3, true],
['SKU-1', 10, 6, true],
['SKU-1', 10, 9, false],
['SKU-3', 10, 1, false],
['SKU-3', 10, 3, false],
['SKU-2', 20, 1, false],
['SKU-2', 20, 3, true],
['SKU-2', 20, 6, 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],
];
}
}

0 comments on commit 1bad503

Please sign in to comment.