Skip to content

Commit

Permalink
Merge pull request magento#1009 from magento-engcom/720
Browse files Browse the repository at this point in the history
MSI-720: Implement IsCorrectQtyConditionTest::testExecuteWithUseConfigMinSaleQty
  • Loading branch information
maghamed authored May 3, 2018
2 parents 9e01d90 + 82f2a30 commit 33f29cc
Showing 1 changed file with 72 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,24 +67,91 @@ protected function setUp()
* @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 executeWithMissingConfigurationDataProvider
*/
public function testExecuteWithMissingConfiguration($sku, $stockId, $requestedQty, bool $expectedResult)
{
public function testExecuteWithMissingConfiguration(
string $sku,
int $stockId,
int $requestedQty,
bool $expectedResult
) {
$result = $this->isProductSalableForRequestedQty->execute($sku, $stockId, $requestedQty);
$this->assertEquals($expectedResult, $result->isSalable());
}

/**
* @return array
*/
public function executeWithMissingConfigurationDataProvider(): array
{
return [
['SKU-2', 10, 1, false],
];
}

public function testExecuteWithUseConfigMinSaleQty()

/**
* @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/min_sale_qty 7
*
* @param string $sku
* @param int $stockId
* @param int $requestedQty
* @param bool $expectedResult
*
* @return void
*
* @dataProvider executeWithUseConfigMinSaleQtyDataProvider
*/
public function testExecuteWithUseConfigMinSaleQty(
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 executeWithUseConfigMinSaleQtyDataProvider(): array
{
$this->markTestIncomplete('Still to implement');
return [
['SKU-1', 10, 1, false],
['SKU-1', 10, 7, true],
['SKU-1', 10, 8, true],
['SKU-2', 10, 1, false],
['SKU-2', 10, 7, false],
['SKU-3', 10, 1, false],
['SKU-3', 10, 7, false],
['SKU-1', 20, 1, false],
['SKU-1', 20, 7, false],
['SKU-2', 20, 1, false],
['SKU-2', 20, 7, false],
['SKU-3', 20, 1, false],
['SKU-3', 20, 7, false],
['SKU-1', 30, 1, false],
['SKU-1', 30, 7, true],
['SKU-1', 30, 8, true],
['SKU-2', 30, 1, false],
['SKU-2', 30, 7, false],
['SKU-3', 30, 1, false],
['SKU-3', 30, 7, false],
];
}

/**
Expand Down

0 comments on commit 33f29cc

Please sign in to comment.