Skip to content

Commit

Permalink
Merge pull request magento#1012 from magento-engcom/1011
Browse files Browse the repository at this point in the history
MSI-1011: Implement IsCorrectQtyConditionTest::testExecuteWithUseConfigQtyIncrements
  • Loading branch information
maghamed authored May 4, 2018
2 parents 1252c8a + 4198838 commit 346aa7b
Showing 1 changed file with 65 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
use Magento\TestFramework\Helper\Bootstrap;
use PHPUnit\Framework\TestCase;

/**
* @magentoAppIsolation enabled
*/
class IsCorrectQtyConditionTest extends TestCase
{
/**
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 346aa7b

Please sign in to comment.