|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * Copyright © Magento, Inc. All rights reserved. |
| 4 | + * See COPYING.txt for license details. |
| 5 | + */ |
| 6 | +declare(strict_types=1); |
| 7 | + |
| 8 | +namespace Magento\CatalogImportExport\Model\Import\ProductTest; |
| 9 | + |
| 10 | +use Magento\Catalog\Model\Indexer\Product\Price\Processor as ProductPriceIndexer; |
| 11 | +use Magento\CatalogSearch\Model\Indexer\Fulltext as FulltextIndexer; |
| 12 | +use Magento\CatalogImportExport\Model\Import\ProductTestBase; |
| 13 | +use Magento\Framework\Indexer\IndexerRegistry; |
| 14 | +use Magento\TestFramework\Helper\Bootstrap as BootstrapHelper; |
| 15 | + |
| 16 | +/** |
| 17 | + * @magentoAppArea adminhtml |
| 18 | + * @magentoDbIsolation disabled |
| 19 | + */ |
| 20 | +class ProductIndexersInvalidationTest extends ProductTestBase |
| 21 | +{ |
| 22 | + /** |
| 23 | + * Test for indexer state in update on save mode |
| 24 | + * |
| 25 | + * @magentoDataFixture Magento/Catalog/_files/multiple_products.php |
| 26 | + */ |
| 27 | + public function testIndexersState() |
| 28 | + { |
| 29 | + $indexerRegistry = BootstrapHelper::getObjectManager()->get(IndexerRegistry::class); |
| 30 | + $fulltextIndexer = $indexerRegistry->get(FulltextIndexer::INDEXER_ID); |
| 31 | + $priceIndexer = $indexerRegistry->get(ProductPriceIndexer::INDEXER_ID); |
| 32 | + $fulltextIndexer->reindexAll(); |
| 33 | + $priceIndexer->reindexAll(); |
| 34 | + |
| 35 | + $this->assertFalse($fulltextIndexer->isScheduled()); |
| 36 | + $this->assertFalse($priceIndexer->isScheduled()); |
| 37 | + $this->assertFalse($fulltextIndexer->isInvalid()); |
| 38 | + $this->assertFalse($priceIndexer->isInvalid()); |
| 39 | + |
| 40 | + $this->importFile('products_to_import.csv'); |
| 41 | + |
| 42 | + $this->assertFalse($fulltextIndexer->isInvalid()); |
| 43 | + $this->assertFalse($priceIndexer->isInvalid()); |
| 44 | + } |
| 45 | +} |
0 commit comments