public function LanguageUnitTest::providerTestSortArrayOfLanguages in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Language/LanguageUnitTest.php \Drupal\Tests\Core\Language\LanguageUnitTest::providerTestSortArrayOfLanguages()
- 9 core/tests/Drupal/Tests/Core/Language/LanguageUnitTest.php \Drupal\Tests\Core\Language\LanguageUnitTest::providerTestSortArrayOfLanguages()
Provides data for testSortArrayOfLanguages.
Return value
array An array of test data.
File
- core/
tests/ Drupal/ Tests/ Core/ Language/ LanguageUnitTest.php, line 106
Class
- LanguageUnitTest
- @coversDefaultClass \Drupal\Core\Language\Language @group Language
Namespace
Drupal\Tests\Core\LanguageCode
public function providerTestSortArrayOfLanguages() {
$language9A = new Language([
'id' => 'dd',
'name' => 'A',
'weight' => 9,
]);
$language10A = new Language([
'id' => 'ee',
'name' => 'A',
'weight' => 10,
]);
$language10B = new Language([
'id' => 'ff',
'name' => 'B',
'weight' => 10,
]);
return [
// Set up data set #0, already ordered by weight.
[
// Set the data.
[
$language9A
->getId() => $language9A,
$language10B
->getId() => $language10B,
],
// Set the expected key order.
[
$language9A
->getId(),
$language10B
->getId(),
],
],
// Set up data set #1, out of order by weight.
[
[
$language10B
->getId() => $language10B,
$language9A
->getId() => $language9A,
],
[
$language9A
->getId(),
$language10B
->getId(),
],
],
// Set up data set #2, tied by weight, already ordered by name.
[
[
$language10A
->getId() => $language10A,
$language10B
->getId() => $language10B,
],
[
$language10A
->getId(),
$language10B
->getId(),
],
],
// Set up data set #3, tied by weight, out of order by name.
[
[
$language10B
->getId() => $language10B,
$language10A
->getId() => $language10A,
],
[
$language10A
->getId(),
$language10B
->getId(),
],
],
];
}