GetAssignedStockIdsBySkuTest.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. declare(strict_types=1);
  7. namespace Magento\InventorySalesAdminUi\Test\Integration\Model\ResourceModel;
  8. use PHPUnit\Framework\TestCase;
  9. use Magento\TestFramework\Helper\Bootstrap;
  10. use Magento\InventorySalesAdminUi\Model\ResourceModel\GetAssignedStockIdsBySku;
  11. class GetAssignedStockIdsBySkuTest extends TestCase
  12. {
  13. /**
  14. * @var GetAssignedStockIdsBySku
  15. */
  16. private $getAssignedStockIdsBySku;
  17. protected function setUp()
  18. {
  19. parent::setUp();
  20. $this->getAssignedStockIdsBySku = Bootstrap::getObjectManager()->get(GetAssignedStockIdsBySku::class);
  21. }
  22. /**
  23. * @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/products.php
  24. * @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/sources.php
  25. * @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/stocks.php
  26. * @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/stock_source_links.php
  27. * @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/source_items.php
  28. *
  29. * @magentoDbIsolation disabled
  30. */
  31. public function testExecute()
  32. {
  33. $productSku = 'SKU-1';
  34. $expectedStockIds = [10, 30];
  35. self::assertEquals($expectedStockIds, $this->getAssignedStockIdsBySku->execute($productSku));
  36. }
  37. }