LowQuantityCollectionTest.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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\InventoryLowQuantityNotification\Test\Integration\Model\ResourceModel;
  8. use Magento\InventoryLowQuantityNotification\Model\ResourceModel\LowQuantityCollection;
  9. use Magento\InventoryLowQuantityNotificationApi\Api\Data\SourceItemConfigurationInterface;
  10. use Magento\TestFramework\Helper\Bootstrap;
  11. use PHPUnit\Framework\TestCase;
  12. class LowQuantityCollectionTest extends TestCase
  13. {
  14. /**
  15. * @var LowQuantityCollection
  16. */
  17. private $lowQuantityCollection;
  18. protected function setUp()
  19. {
  20. $this->lowQuantityCollection = Bootstrap::getObjectManager()->create(LowQuantityCollection::class);
  21. }
  22. /**
  23. * Tests that products from disabled sources are not present.
  24. * Each source code is used exclusively in one source item, so we check only source codes.
  25. *
  26. * @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/products.php
  27. * @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/sources.php
  28. * @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/stocks.php
  29. * @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/source_items.php
  30. * @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/stock_source_links.php
  31. * @codingStandardsIgnoreLine
  32. * @magentoDataFixture ../../../../app/code/Magento/InventoryLowQuantityNotificationApi/Test/_files/source_item_configuration.php
  33. */
  34. public function testLowQuantityCollection()
  35. {
  36. $expectedSourceCodes = [
  37. 'eu-1'
  38. ];
  39. $actualSourceCodes = $this->lowQuantityCollection->getColumnValues(
  40. SourceItemConfigurationInterface::SOURCE_CODE
  41. );
  42. $this->assertEquals($expectedSourceCodes, $actualSourceCodes);
  43. }
  44. }