Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
GetStockItemDataTest.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 GetStockItemDataTest 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 
47  public function testGetStockItemData(string $sku, int $stockId, $expectedData)
48  {
49  $stockItemData = $this->getStockItemData->execute($sku, $stockId);
50  self::assertEquals($expectedData, $stockItemData);
51  }
52 
54  {
55  $stockItemData = $this->getStockItemData->execute('SKU-1', 10);
56  self::assertNull($stockItemData);
57  }
58 
62  public function getStockItemDataDataProvider(): array
63  {
64  return [
66  ['SKU-1', 20, null],
68  ['SKU-2', 10, null],
72  ['SKU-3', 20, null],
74  ];
75  }
76 }