Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
GetProductIdsBySkusTest.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 GetProductIdsBySkusTest extends TestCase
15 {
19  private $getProductIdsBySkus;
20 
21  protected function setUp()
22  {
23  parent::setUp();
24 
25  $this->getProductIdsBySkus = Bootstrap::getObjectManager()->get(GetProductIdsBySkusInterface::class);
26  }
27 
31  public function testExecute()
32  {
33  $idBySku = ['search_product_1' => 101, 'search_product_2' => 102, 'search_product_3' => 103];
34 
35  self::assertEquals($idBySku, $this->getProductIdsBySkus->execute(array_keys($idBySku)));
36  }
37 
45  {
46  $skus = ['not_existed_1', 'not_existed_2', 'search_product_2'];
47 
48  $this->getProductIdsBySkus->execute($skus);
49  }
50 }
foreach($websiteCodes as $websiteCode) $skus