Skip to content

Commit 5bc1d37

Browse files
committed
ACP2E-330: When partial indexer is executed catalog rule prices get removed
- Remove integration test
1 parent 3a84f46 commit 5bc1d37

File tree

1 file changed

+18
-86
lines changed

1 file changed

+18
-86
lines changed

dev/tests/integration/testsuite/Magento/CatalogRuleConfigurable/Model/Indexer/Product/ProductRuleIndexerTest.php

Lines changed: 18 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,8 @@
1717

1818
/**
1919
* @magentoDbIsolation disabled
20-
* @magentoAppIsolation enabled
2120
* @magentoAppArea adminhtml
22-
* @magentoDataFixture Magento/Catalog/_files/categories_no_products.php
2321
* @magentoDataFixture Magento/CatalogRuleConfigurable/_files/configurable_product_with_percent_rule.php
24-
* @magentoDataFixture Magento/CatalogRuleConfigurable/_files/configurable_product_with_categories_rule.php
2522
*/
2623
class ProductRuleIndexerTest extends TestCase
2724
{
@@ -52,116 +49,51 @@ protected function setUp(): void
5249
}
5350

5451
/**
55-
* @dataProvider productsDataProvider
56-
* @param string $reindexSku
57-
* @param array $expectedPrices
5852
* @return void
59-
* @throws \Magento\Framework\Exception\NoSuchEntityException
6053
*/
61-
public function testExecute(string $reindexSku, array $expectedPrices): void
54+
public function testExecute(): void
6255
{
63-
$product = $this->productRepository->get($reindexSku);
56+
$product = $this->productRepository->get('configurable');
6457
$this->productRuleIndexer->execute([$product->getId()]);
6558

66-
$this->assertEquals($expectedPrices, $this->getCatalogRulePrices(array_keys($expectedPrices)));
59+
$product = $this->productRepository->get('simple_10');
60+
$price = $this->getCatalogRulePrice($product);
61+
$this->assertEquals(5, $price);
6762
}
6863

6964
/**
70-
* @dataProvider productsDataProvider
71-
* @param string $reindexSku
72-
* @param array $expectedPrices
7365
* @return void
74-
* @throws \Magento\Framework\Exception\LocalizedException
75-
* @throws \Magento\Framework\Exception\NoSuchEntityException
7666
*/
77-
public function testExecuteRow(string $reindexSku, array $expectedPrices): void
67+
public function testExecuteRow(): void
7868
{
79-
$product = $this->productRepository->get($reindexSku);
69+
$product = $this->productRepository->get('configurable');
8070
$this->productRuleIndexer->executeRow($product->getId());
8171

82-
$this->assertEquals($expectedPrices, $this->getCatalogRulePrices(array_keys($expectedPrices)));
72+
$product = $this->productRepository->get('simple_10');
73+
$price = $this->getCatalogRulePrice($product);
74+
$this->assertEquals(5, $price);
8375
}
8476

8577
/**
86-
* @dataProvider productsDataProvider
87-
* @param string $reindexSku
88-
* @param array $expectedPrices
8978
* @return void
90-
* @throws \Magento\Framework\Exception\LocalizedException
91-
* @throws \Magento\Framework\Exception\NoSuchEntityException
9279
*/
93-
public function testExecuteList(string $reindexSku, array $expectedPrices): void
80+
public function testExecuteList(): void
9481
{
95-
$product = $this->productRepository->get($reindexSku);
82+
$product = $this->productRepository->get('configurable');
9683
$this->productRuleIndexer->executeList([$product->getId()]);
9784

98-
$this->assertEquals($expectedPrices, $this->getCatalogRulePrices(array_keys($expectedPrices)));
85+
$product = $this->productRepository->get('simple_10');
86+
$price = $this->getCatalogRulePrice($product);
87+
$this->assertEquals(5, $price);
9988
}
10089

101-
/**
102-
* @return void
103-
*/
10490
public function testExecuteFull(): void
10591
{
10692
$this->productRuleIndexer->executeFull();
10793

108-
$expectedPrices = [
109-
'simple_10' => 5,
110-
'simple_20' => 10,
111-
'simple_30' => 15,
112-
'simple_40' => 20,
113-
];
114-
$this->assertEquals($expectedPrices, $this->getCatalogRulePrices(array_keys($expectedPrices)));
115-
}
116-
117-
/**
118-
* @return array
119-
*/
120-
public function productsDataProvider(): array
121-
{
122-
return [
123-
[
124-
'configurable',
125-
[
126-
'simple_10' => 5,
127-
'simple_20' => 10,
128-
]
129-
],
130-
[
131-
'simple_10',
132-
[
133-
'simple_10' => 5,
134-
]
135-
],
136-
[
137-
'12345',
138-
[
139-
'simple_30' => 15,
140-
'simple_40' => 20,
141-
]
142-
],
143-
[
144-
'simple_30',
145-
[
146-
'simple_30' => 15,
147-
]
148-
],
149-
];
150-
}
151-
152-
/**
153-
* @param array $skus
154-
* @return array
155-
* @throws \Magento\Framework\Exception\NoSuchEntityException
156-
*/
157-
private function getCatalogRulePrices(array $skus): array
158-
{
159-
$actualPrices = [];
160-
foreach ($skus as $sku) {
161-
$product = $this->productRepository->get($sku);
162-
$actualPrices[$sku] = $this->getCatalogRulePrice($product);
163-
}
164-
return $actualPrices;
94+
$product = $this->productRepository->get('simple_10');
95+
$price = $this->getCatalogRulePrice($product);
96+
$this->assertEquals(5, $price);
16597
}
16698

16799
/**

0 commit comments

Comments
 (0)