Skip to content

Commit 0857bd7

Browse files
authored
Merge branch '2.4-develop' into platform-health
2 parents d99296c + 1807f70 commit 0857bd7

File tree

5 files changed

+31
-30
lines changed

5 files changed

+31
-30
lines changed

dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductSearchTest.php

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,11 +1616,16 @@ public function testFilterProductsBySingleCategoryId(string $fieldName, string $
16161616
/**
16171617
* Sorting the search results by relevance (DESC => most relevant)
16181618
*
1619+
* Sorting by relevance may return different results depending on the ES.
1620+
* To check that sorting works, we compare results with ASC and DESC relevance sorting
1621+
*
16191622
* Search for products for a fuzzy match and checks if all matching results returned including
16201623
* results based on matching keywords from description
16211624
*
16221625
* @magentoApiDataFixture Magento/Catalog/_files/products_for_relevance_sorting.php
16231626
* @return void
1627+
*
1628+
* @throws \Exception
16241629
*/
16251630
public function testSearchAndSortByRelevance()
16261631
{
@@ -1630,7 +1635,7 @@ public function testSearchAndSortByRelevance()
16301635
{
16311636
products(
16321637
search:"{$search_term}"
1633-
sort:{relevance:DESC}
1638+
sort:{relevance:%s}
16341639
pageSize: 5
16351640
currentPage: 1
16361641
)
@@ -1671,16 +1676,16 @@ public function testSearchAndSortByRelevance()
16711676
16721677
}
16731678
QUERY;
1674-
$response = $this->graphQlQuery($query);
1675-
$this->assertEquals(3, $response['products']['total_count']);
1676-
$this->assertNotEmpty($response['products']['filters'], 'Filters should have the Category layer');
1677-
$this->assertEquals('Colorful Category', $response['products']['filters'][0]['filter_items'][0]['label']);
1678-
$this->assertCount(2, $response['products']['aggregations']);
1679-
$productsInResponse = ['Blue briefs', 'Navy Blue Striped Shoes', 'Grey shorts'];
1680-
$count = count($response['products']['items']);
1681-
for ($i = 0; $i < $count; $i++) {
1682-
$this->assertEquals($productsInResponse[$i], $response['products']['items'][$i]['name']);
1683-
}
1679+
$responseDesc = $this->graphQlQuery(sprintf($query, 'DESC'));
1680+
$responseAsc = $this->graphQlQuery(sprintf($query, 'ASC'));
1681+
$this->assertEquals(3, $responseDesc['products']['total_count']);
1682+
$this->assertNotEmpty($responseDesc['products']['filters'], 'Filters should have the Category layer');
1683+
$this->assertEquals('Colorful Category', $responseDesc['products']['filters'][0]['filter_items'][0]['label']);
1684+
$this->assertCount(2, $responseDesc['products']['aggregations']);
1685+
$expectedProductsInResponse = ['Blue briefs', 'Navy Blue Striped Shoes', 'Grey shorts'];
1686+
$namesDesc = array_column($responseDesc['products']['items'], 'name');
1687+
$this->assertEqualsCanonicalizing($expectedProductsInResponse, $namesDesc);
1688+
$this->assertEquals($namesDesc, array_reverse(array_column($responseAsc['products']['items'], 'name')));
16841689
}
16851690

16861691
/**

dev/tests/integration/testsuite/Magento/Elasticsearch/Model/Indexer/ReindexAllTest.php

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -144,29 +144,25 @@ public function testSortCaseSensitive(): void
144144
$productThird = $this->productRepository->get('fulltext-3');
145145
$productFourth = $this->productRepository->get('fulltext-4');
146146
$productFifth = $this->productRepository->get('fulltext-5');
147-
$correctSortedIds = [
148-
$productFirst->getId(),
149-
$productFourth->getId(),
150-
$productSecond->getId(),
151-
$productFifth->getId(),
152-
$productThird->getId(),
153-
];
147+
154148
$this->reindexAll();
155149
$result = $this->sortByName();
156150
$firstInSearchResults = (int) $result[0]['_id'];
157151
$secondInSearchResults = (int) $result[1]['_id'];
158152
$thirdInSearchResults = (int) $result[2]['_id'];
159153
$fourthInSearchResults = (int) $result[3]['_id'];
160154
$fifthInSearchResults = (int) $result[4]['_id'];
161-
$actualSortedIds = [
162-
$firstInSearchResults,
163-
$secondInSearchResults,
164-
$thirdInSearchResults,
165-
$fourthInSearchResults,
166-
$fifthInSearchResults
167-
];
168-
$this->assertCount(5, $result);
169-
$this->assertEquals($correctSortedIds, $actualSortedIds);
155+
156+
self::assertCount(5, $result);
157+
self::assertEqualsCanonicalizing(
158+
[$productFirst->getId(), $productFourth->getId()],
159+
[$firstInSearchResults, $secondInSearchResults]
160+
);
161+
self::assertEqualsCanonicalizing(
162+
[$productSecond->getId(), $productFifth->getId()],
163+
[$thirdInSearchResults, $fourthInSearchResults]
164+
);
165+
self::assertEquals($productThird->getId(), $fifthInSearchResults);
170166
}
171167

172168
/**

dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/MultipleFiltersTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function testGetMultipleActiveFilters(
4848
);
4949
$this->navigationBlock->setLayout($this->layout);
5050
$resultProducts = $this->getProductSkus($this->navigationBlock->getLayer()->getProductCollection());
51-
$this->assertEquals($expectedProducts, $resultProducts);
51+
self::assertEqualsCanonicalizing($expectedProducts, $resultProducts);
5252
}
5353

5454
/**

dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Search/MultipleFiltersTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function testGetMultipleActiveFilters(
4545
);
4646
$this->navigationBlock->setLayout($this->layout);
4747
$resultProducts = $this->getProductSkus($this->navigationBlock->getLayer()->getProductCollection());
48-
$this->assertEquals($expectedProducts, $resultProducts);
48+
self::assertEqualsCanonicalizing($expectedProducts, $resultProducts);
4949
}
5050

5151
/**

lib/web/jquery/spectrum/tinycolor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// TinyColor v1.4.1
1+
// TinyColor v1.4.2
22
// https://github.com/bgrins/TinyColor
33
// Brian Grinstead, MIT License
44

0 commit comments

Comments
 (0)