|
6 | 6 | namespace Magento\Elasticsearch\Model\Indexer;
|
7 | 7 |
|
8 | 8 | use Magento\Catalog\Api\ProductRepositoryInterface;
|
| 9 | +use Magento\Catalog\Test\Fixture\Product as ProductFixture; |
9 | 10 | use Magento\Indexer\Model\Indexer;
|
| 11 | +use Magento\TestFramework\Fixture\DataFixture; |
10 | 12 | use Magento\TestFramework\Helper\Bootstrap;
|
11 | 13 | use Magento\Store\Model\StoreManagerInterface;
|
12 | 14 | use Magento\Elasticsearch\SearchAdapter\ConnectionManager;
|
@@ -166,6 +168,29 @@ public function testSortCaseSensitive(): void
|
166 | 168 | self::assertEquals($productThird->getId(), $fifthInSearchResults);
|
167 | 169 | }
|
168 | 170 |
|
| 171 | + #[ |
| 172 | + DataFixture(ProductFixture::class, ['sku' => 'p1', 'name' => 'A']), |
| 173 | + DataFixture(ProductFixture::class, ['sku' => 'p2', 'name' => 'Ç']), |
| 174 | + DataFixture(ProductFixture::class, ['sku' => 'p3', 'name' => 'D']), |
| 175 | + DataFixture(ProductFixture::class, ['sku' => 'p4', 'name' => 'Ü']), |
| 176 | + DataFixture(ProductFixture::class, ['sku' => 'p5', 'name' => 'Z']), |
| 177 | + ] |
| 178 | + public function testSortAccentedCharacters(): void |
| 179 | + { |
| 180 | + $expectedOrder = [ |
| 181 | + (int) $this->productRepository->get('p1')->getId(), |
| 182 | + (int) $this->productRepository->get('p2')->getId(), |
| 183 | + (int) $this->productRepository->get('p3')->getId(), |
| 184 | + (int) $this->productRepository->get('p4')->getId(), |
| 185 | + (int) $this->productRepository->get('p5')->getId(), |
| 186 | + ]; |
| 187 | + $this->reindexAll(); |
| 188 | + |
| 189 | + $result = $this->sortByName(); |
| 190 | + $actualOrder = array_map(fn ($id) => (int) $id, array_column($result, '_id')); |
| 191 | + self::assertEquals($expectedOrder, $actualOrder); |
| 192 | + } |
| 193 | + |
169 | 194 | /**
|
170 | 195 | * Test search of specific product after full reindex
|
171 | 196 | *
|
|
0 commit comments