public function LanguageUnitTest::providerTestSortArrayOfLanguages in Zircon Profile 8.0
Same name and namespace in other branches
- 8 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 111 - Contains \Drupal\Tests\Core\Language\LanguageUnitTest.
Class
- LanguageUnitTest
- @coversDefaultClass \Drupal\Core\Language\Language @group Language
Namespace
Drupal\Tests\Core\LanguageCode
public function providerTestSortArrayOfLanguages() {
$language9A = new Language(array(
'id' => 'dd',
'name' => 'A',
'weight' => 9,
));
$language10A = new Language(array(
'id' => 'ee',
'name' => 'A',
'weight' => 10,
));
$language10B = new Language(array(
'id' => 'ff',
'name' => 'B',
'weight' => 10,
));
return array(
// Set up data set #0, already ordered by weight.
array(
// Set the data.
array(
$language9A
->getId() => $language9A,
$language10B
->getId() => $language10B,
),
// Set the expected key order.
array(
$language9A
->getId(),
$language10B
->getId(),
),
),
// Set up data set #1, out of order by weight.
array(
array(
$language10B
->getId() => $language10B,
$language9A
->getId() => $language9A,
),
array(
$language9A
->getId(),
$language10B
->getId(),
),
),
// Set up data set #2, tied by weight, already ordered by name.
array(
array(
$language10A
->getId() => $language10A,
$language10B
->getId() => $language10B,
),
array(
$language10A
->getId(),
$language10B
->getId(),
),
),
// Set up data set #3, tied by weight, out of order by name.
array(
array(
$language10B
->getId() => $language10B,
$language10A
->getId() => $language10A,
),
array(
$language10A
->getId(),
$language10B
->getId(),
),
),
);
}