Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
MinQtyConditionTest.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
12 use PHPUnit\Framework\TestCase;
13 
14 class MinQtyConditionTest extends TestCase
15 {
19  private $getStockItemData;
20 
24  protected function setUp()
25  {
26  parent::setUp();
27 
28  $this->getStockItemData = Bootstrap::getObjectManager()->get(GetStockItemDataInterface::class);
29  }
30 
49  public function testExecuteWithMinQty(string $sku, int $stockId, $expectedData)
50  {
51  $stockItemData = $this->getStockItemData->execute($sku, $stockId);
52 
53  self::assertEquals($expectedData, $stockItemData);
54  }
55 
59  public function executeWithMinQtyDataProvider(): array
60  {
61  return [
63  ['SKU-1', 20, null],
65  ['SKU-2', 10, null],
69  ['SKU-3', 20, null],
71  ];
72  }
73 
93  public function testExecuteWithManageStockFalseAndMinQty(string $sku, int $stockId, $expectedData)
94  {
95  $stockItemData = $this->getStockItemData->execute($sku, $stockId);
96 
97  self::assertEquals($expectedData, $stockItemData);
98  }
99 
103  public function executeWithManageStockFalseAndMinQty(): array
104  {
105  return [
107  ['SKU-1', 20, null],
109  ['SKU-2', 10, null],
113  ['SKU-3', 20, null],
115  ];
116  }
117 }