/** * Tests SortArray::sortByWeightAndTitleKey() input against expected output. * * @dataProvider providerTestSortByWeightAndTitleKey * * @param array $a * The first input item for comparison. * @param array $b * The second item for comparison. * @param integer $expected * The expected output from calling the method. */ public function testSortByWeightAndTitleKey($a, $b, $expected) { $result = SortArray::sortByWeightAndTitleKey($a, $b); $this->assertEquals($expected, $result); }
/** * Sort language objects. * * @param array $languages * The array of language objects keyed by langcode. */ public static function sort(&$languages) { uasort($languages, function ($a, $b) { return SortArray::sortByWeightAndTitleKey($a, $b, 'weight', 'name'); }); }