Skip to content

Commit 13c7a1a

Browse files
committed
ACP2E-1569: Elasticsearch Indexer document version changes version when new/existing products are imported
1 parent e15522c commit 13c7a1a

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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

Comments
 (0)