Skip to content

Commit e226cb2

Browse files
committed
Merge remote-tracking branch 'origin/MC-33231-tests' into MC-33394-pr-delivery
2 parents 502f237 + 3ffb067 commit e226cb2

File tree

6 files changed

+267
-120
lines changed

6 files changed

+267
-120
lines changed

dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ListProduct/SortingTest.php

Lines changed: 100 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,18 @@ protected function setUp()
8989
* @param string $sortBy
9090
* @param string $direction
9191
* @param array $expectation
92+
* @param string|null $incompleteReason
9293
* @return void
9394
*/
94-
public function testProductListSortOrder(string $sortBy, string $direction, array $expectation): void
95-
{
95+
public function testProductListSortOrder(
96+
string $sortBy,
97+
string $direction,
98+
array $expectation,
99+
string $incompleteReason = null
100+
): void {
101+
if ($incompleteReason) {
102+
$this->markTestIncomplete($incompleteReason);
103+
}
96104
$category = $this->updateCategorySortBy('Category 1', Store::DEFAULT_STORE_ID, $sortBy);
97105
$this->renderBlock($category, $direction);
98106
$this->assertBlockSorting($sortBy, $expectation);
@@ -104,10 +112,18 @@ public function testProductListSortOrder(string $sortBy, string $direction, arra
104112
* @param string $sortBy
105113
* @param string $direction
106114
* @param array $expectation
115+
* @param string|null $incompleteReason
107116
* @return void
108117
*/
109-
public function testProductListSortOrderWithConfig(string $sortBy, string $direction, array $expectation): void
110-
{
118+
public function testProductListSortOrderWithConfig(
119+
string $sortBy,
120+
string $direction,
121+
array $expectation,
122+
string $incompleteReason = null
123+
): void {
124+
if ($incompleteReason) {
125+
$this->markTestIncomplete($incompleteReason);
126+
}
111127
$this->assertProductListSortOrderWithConfig($sortBy, $direction, $expectation);
112128
}
113129

@@ -147,17 +163,20 @@ public function productListSortOrderDataProvider(): array
147163
'direction' => 'desc',
148164
'expectation' => ['simple3', 'simple2', 'simple1'],
149165
],
150-
// TODO: Skipped MC-33231
151-
//'default_order_custom_attribute_asc' => [
152-
// 'sort' => 'test_configurable',
153-
// 'direction' => 'asc',
154-
// 'expectation' => ['simple1', 'simple3', 'simple2'],
155-
//],
156-
//'default_order_custom_attribute_desc' => [
157-
// 'sort' => 'test_configurable',
158-
// 'direction' => 'desc',
159-
// 'expectation' => ['simple3', 'simple2', 'simple1'],
160-
//],
166+
'default_order_custom_attribute_asc' => [
167+
'sort' => 'test_configurable',
168+
'direction' => 'asc',
169+
'expectation' => ['simple1', 'simple3', 'simple2'],
170+
'incomplete_reason' => 'MC-33825:'
171+
. 'Stabilize skipped test cases for Integration SortingTest with elasticsearch',
172+
],
173+
'default_order_custom_attribute_desc' => [
174+
'sort' => 'test_configurable',
175+
'direction' => 'desc',
176+
'expectation' => ['simple3', 'simple2', 'simple1'],
177+
'incomplete_reason' => 'MC-33825:'
178+
. 'Stabilize skipped test cases for Integration SortingTest with elasticsearch',
179+
],
161180
];
162181
}
163182

@@ -169,14 +188,19 @@ public function productListSortOrderDataProvider(): array
169188
* @param string $direction
170189
* @param array $expectation
171190
* @param string $defaultSortBy
191+
* @param string|null $incompleteReason
172192
* @return void
173193
*/
174194
public function testProductListSortOrderOnStoreView(
175195
string $sortBy,
176196
string $direction,
177197
array $expectation,
178-
string $defaultSortBy
198+
string $defaultSortBy,
199+
string $incompleteReason = null
179200
): void {
201+
if ($incompleteReason) {
202+
$this->markTestIncomplete($incompleteReason);
203+
}
180204
$secondStoreId = (int)$this->storeManager->getStore('fixture_second_store')->getId();
181205
$this->updateCategorySortBy('Category 1', Store::DEFAULT_STORE_ID, $defaultSortBy);
182206
$category = $this->updateCategorySortBy('Category 1', $secondStoreId, $sortBy);
@@ -192,14 +216,19 @@ public function testProductListSortOrderOnStoreView(
192216
* @param string $direction
193217
* @param array $expectation
194218
* @param string $defaultSortBy
219+
* @param string|null $incompleteReason,
195220
* @return void
196221
*/
197222
public function testProductListSortOrderWithConfigOnStoreView(
198223
string $sortBy,
199224
string $direction,
200225
array $expectation,
201-
string $defaultSortBy
226+
string $defaultSortBy,
227+
string $incompleteReason = null
202228
): void {
229+
if ($incompleteReason) {
230+
$this->markTestIncomplete($incompleteReason);
231+
}
203232
$this->objectManager->removeSharedInstance(Config::class);
204233
$secondStoreId = (int)$this->storeManager->getStore('fixture_second_store')->getId();
205234
$this->scopeConfig->setValue(
@@ -225,20 +254,60 @@ public function testProductListSortOrderWithConfigOnStoreView(
225254
*/
226255
public function productListSortOrderDataProviderOnStoreView(): array
227256
{
228-
return array_merge_recursive(
229-
$this->productListSortOrderDataProvider(),
230-
[
231-
'default_order_price_asc' => ['default_sort' => 'position'],
232-
'default_order_price_desc' => ['default_sort' => 'position'],
233-
'default_order_position_asc' => ['default_sort' => 'price'],
234-
'default_order_position_desc' => ['default_sort' => 'price'],
235-
'default_order_name_asc' => ['default_sort' => 'price'],
236-
'default_order_name_desc' => ['default_sort' => 'price'],
237-
// TODO: Skipped MC-33231
238-
//'default_order_custom_attribute_asc' => ['default_sort' => 'price'],
239-
//'default_order_custom_attribute_desc' => ['default_sort' => 'price'],
240-
]
241-
);
257+
return [
258+
'default_order_price_asc' => [
259+
'sort' => 'price',
260+
'direction' => 'asc',
261+
'expectation' => ['simple1', 'simple2', 'simple3'],
262+
'default_sort' => 'position'
263+
],
264+
'default_order_price_desc' => [
265+
'sort' => 'price',
266+
'direction' => 'desc',
267+
'expectation' => ['simple3', 'simple2', 'simple1'],
268+
'default_sort' => 'position'
269+
],
270+
'default_order_position_asc' => [
271+
'sort' => 'position',
272+
'direction' => 'asc',
273+
'expectation' => ['simple1', 'simple2', 'simple3'],
274+
'default_sort' => 'price'
275+
],
276+
'default_order_position_desc' => [
277+
'sort' => 'position',
278+
'direction' => 'desc',
279+
'expectation' => ['simple3', 'simple2', 'simple1'],
280+
'default_sort' => 'price'
281+
],
282+
'default_order_name_asc' => [
283+
'sort' => 'name',
284+
'direction' => 'asc',
285+
'expectation' => ['simple1', 'simple2', 'simple3'],
286+
'default_sort' => 'price'
287+
],
288+
'default_order_name_desc' => [
289+
'sort' => 'name',
290+
'direction' => 'desc',
291+
'expectation' => ['simple3', 'simple2', 'simple1'],
292+
'default_sort' => 'price'
293+
],
294+
'default_order_custom_attribute_asc' => [
295+
'sort' => 'test_configurable',
296+
'direction' => 'asc',
297+
'expectation' => ['simple1', 'simple3', 'simple2'],
298+
'default_sort' => 'price',
299+
'incomplete_reason' => 'MC-33825:'
300+
. 'Stabilize skipped test cases for Integration SortingTest with elasticsearch',
301+
],
302+
'default_order_custom_attribute_desc' => [
303+
'sort' => 'test_configurable',
304+
'direction' => 'desc',
305+
'expectation' => ['simple3', 'simple2', 'simple1'],
306+
'default_sort' => 'price',
307+
'incomplete_reason' => 'MC-33825:'
308+
. 'Stabilize skipped test cases for Integration SortingTest with elasticsearch',
309+
],
310+
];
242311
}
243312

244313
/**

dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/DataProvider/PriceTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,11 @@ public function testGetMaxPriceInt()
7171
public function getRangeItemCountsDataProvider()
7272
{
7373
return [
74-
[1, [11 => 2, 46 => 1]],
75-
[10, [2 => 2, 5 => 1]],
76-
[20, [1 => 2, 3 => 1]],
77-
[50, [1 => 3]]
74+
// These are $inputRange, [$expectedItemCounts] values
75+
[1, [11 => 2, 46 => 1, 16 => '1']],
76+
[10, [2 => 3, 5 => 1]],
77+
[20, [1 => 3, 3 => 1]],
78+
[50, [1 => 4]]
7879
];
7980
}
8081

@@ -85,7 +86,6 @@ public function getRangeItemCountsDataProvider()
8586
*/
8687
public function testGetRangeItemCounts($inputRange, $expectedItemCounts)
8788
{
88-
$this->markTestSkipped('MC-33231: Mysql Search Engine is deprecated. This test need stabilization.');
8989
$actualItemCounts = $this->_model->getRangeItemCounts($inputRange);
9090
$this->assertEquals($expectedItemCounts, $actualItemCounts);
9191
}

dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/Price/AlgorithmBaseTest.php

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,13 @@ class AlgorithmBaseTest extends \PHPUnit\Framework\TestCase
3939
* @magentoDbIsolation disabled
4040
* @magentoAppIsolation enabled
4141
* @dataProvider pricesSegmentationDataProvider
42+
* @param $categoryId
43+
* @param array $entityIds
44+
* @param array $intervalItems
4245
* @covers \Magento\Framework\Search\Dynamic\Algorithm::calculateSeparators
4346
*/
4447
public function testPricesSegmentation($categoryId, array $entityIds, array $intervalItems)
4548
{
46-
$this->markTestSkipped('MC-33231: Mysql Search Engine is deprecated. This test need stabilization.');
4749
$objectManager = Bootstrap::getObjectManager();
4850
$layer = $objectManager->create(\Magento\Catalog\Model\Layer\Category::class);
4951
/** @var \Magento\Framework\Search\Request\Aggregation\TermBucket $termBucket */
@@ -110,7 +112,7 @@ public function testPricesSegmentation($categoryId, array $entityIds, array $int
110112
);
111113

112114
$items = $model->calculateSeparators($interval);
113-
$this->assertEquals(array_keys($intervalItems), array_keys($items));
115+
$this->assertEquals($intervalItems, $items);
114116

115117
for ($i = 0, $count = count($intervalItems); $i < $count; ++$i) {
116118
$this->assertInternalType('array', $items[$i]);
@@ -129,15 +131,40 @@ public function testPricesSegmentation($categoryId, array $entityIds, array $int
129131
public function pricesSegmentationDataProvider()
130132
{
131133
$testCases = include __DIR__ . '/_files/_algorithm_base_data.php';
134+
$testCasesNew = $this->getUnSkippedTestCases($testCases);
132135
$result = [];
133-
foreach ($testCases as $index => $testCase) {
136+
foreach ($testCasesNew as $index => $testCase) {
134137
$result[] = [
135138
$index + 4, //category id
136139
$testCase[1],
137140
$testCase[2],
138141
];
139142
}
140-
141143
return $result;
142144
}
145+
146+
/**
147+
* Get unSkipped test cases from dataProvider
148+
*
149+
* @param array $testCases
150+
* @return array
151+
*/
152+
private function getUnSkippedTestCases(array $testCases) : array
153+
{
154+
// TO DO UnSkip skipped test cases and remove this function
155+
$SkippedTestCases = [];
156+
$UnSkippedTestCases = [];
157+
foreach ($testCases as $testCase) {
158+
if (array_key_exists('incomplete_reason', $testCase)) {
159+
if ($testCase['incomplete_reason'] === " ") {
160+
$UnSkippedTestCases [] = $testCase;
161+
} else {
162+
if ($testCase['incomplete_reason'] != " ") {
163+
$SkippedTestCases [] = $testCase;
164+
}
165+
}
166+
}
167+
}
168+
return $UnSkippedTestCases;
169+
}
143170
}

0 commit comments

Comments
 (0)