Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AddStockDataToCollectionOnDefaultStockTest.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
13 use PHPUnit\Framework\TestCase;
14 
16 {
20  private $stockStatus;
21 
25  protected function setUp()
26  {
27  parent::setUp();
28 
29  $this->stockStatus = Bootstrap::getObjectManager()->create(StockStatus::class);
30  }
31 
42  public function testAddStockDataToCollection(int $expectedSize, bool $isFilterInStock)
43  {
44  $collection = Bootstrap::getObjectManager()->create(Collection::class);
45  $collection = $this->stockStatus->addStockDataToCollection($collection, $isFilterInStock);
46 
47  self::assertEquals($expectedSize, $collection->getSize());
48  }
49 
53  public function addStockDataToCollectionDataProvider(): array
54  {
55  return [
56  [3, true],
57  [5, false],
58  ];
59  }
60 }