Skip to content

Commit 95584a3

Browse files
committed
Merge branch 'MC-39632' into 2.4-develop-sidecar-pr13
2 parents 7da6573 + af5320b commit 95584a3

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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\Catalog\Model\Indexer\Product\Price;
9+
10+
use Magento\Customer\Api\Data\GroupInterfaceFactory;
11+
use Magento\Framework\ObjectManagerInterface;
12+
use Magento\TestFramework\Helper\Bootstrap;
13+
use PHPUnit\Framework\TestCase;
14+
15+
/**
16+
* Checks that the invalidate price index model is working correctly
17+
*
18+
* @see \Magento\Catalog\Model\Indexer\Product\Price\InvalidateIndex
19+
*/
20+
class InvalidateIndexTest extends TestCase
21+
{
22+
/** @var ObjectManagerInterface */
23+
private $objectManager;
24+
25+
/** @var UpdateIndexInterface */
26+
private $invalidatePriceIndex;
27+
28+
/** @var Processor */
29+
private $priceIndexerProcessor;
30+
31+
/** @var GroupInterfaceFactory */
32+
private $customerGroupDataFactory;
33+
34+
/**
35+
* @inheritdoc
36+
*/
37+
protected function setUp(): void
38+
{
39+
parent::setUp();
40+
41+
$this->objectManager = Bootstrap::getObjectManager();
42+
$this->invalidatePriceIndex = $this->objectManager->get(InvalidateIndex::class);
43+
$this->priceIndexerProcessor = $this->objectManager->get(Processor::class);
44+
$this->customerGroupDataFactory = $this->objectManager->get(GroupInterfaceFactory::class);
45+
}
46+
47+
/**
48+
* @magentoDbIsolation disabled
49+
* @return void
50+
*/
51+
public function testUpdate(): void
52+
{
53+
$this->priceIndexerProcessor->reindexAll();
54+
$this->assertTrue($this->priceIndexerProcessor->getIndexer()->isValid());
55+
$customerGroupData = $this->customerGroupDataFactory->create();
56+
$this->invalidatePriceIndex->update($customerGroupData, true);
57+
$this->assertTrue($this->priceIndexerProcessor->getIndexer()->isInvalid());
58+
}
59+
}

0 commit comments

Comments
 (0)