public function testLanguageSorting(array
$languages, ?array
$expectedOrder = null
): void
{ $request =
new Request();
foreach ($languages as &
$language) { $language['id'
] =
$this->
createLanguage($language['name'
]);
} unset($language);
$context =
$this->
createSalesChannelContext($this->
prepareSalesChannelOverride($languages));
$pageLanguages =
$this->
getPageLoader()->
load($request,
$context)->
getHeader()->
getLanguages()->
getElements();
$i = 0;
foreach ($pageLanguages as $pageLanguage) { static::
assertSame($expectedOrder[$i],
$pageLanguage->
getName());
++
$i;
} } /**
* Warning: Sorting is done after the position of the character inside the used collation.
* Some characters like A and Ä share one position since Ä is being seen as A with decorations.
* Adding a test case with e.g. Alang and Älang with an expected order will introduce flakynes.
*/