public function SortArrayTest::providerSortByWeightAndName in Modules weight 8
Same name and namespace in other branches
- 8.2 tests/src/Unit/Utility/SortArrayTest.php \Drupal\Tests\modules_weight\Unit\Utility\SortArrayTest::providerSortByWeightAndName()
Data provider for testSortByWeightAndName().
Return value
array An array of arrays, each containing:
- 'expected' - Expected return from SortArray::sortByWeightAndName().
- 'a' - The first input array.
- 'b' - The second input array.
See also
testSortByWeightAndName()
File
- tests/
src/ Unit/ Utility/ SortArrayTest.php, line 48
Class
- SortArrayTest
- Tests the SortArray class methods.
Namespace
Drupal\Tests\modules_weight\Unit\UtilityCode
public function providerSortByWeightAndName() {
$tests['same weight different name 1'] = [
-1,
[
'name' => 'Admin Toolbar',
'weight' => 1,
],
[
'name' => 'Asana',
'weight' => 1,
],
];
$tests['same weight different name 2'] = [
1,
[
'name' => 'Asana',
'weight' => 1,
],
[
'name' => 'Admin Toolbar',
'weight' => 1,
],
];
$tests['different weight 1'] = [
-1,
[
'name' => 'Asana',
'weight' => -15,
],
[
'name' => 'Admin Toolbar',
'weight' => 8,
],
];
$tests['different weight 2'] = [
1,
[
'name' => 'Asana',
'weight' => 51,
],
[
'name' => 'Admin Toolbar',
'weight' => -10,
],
];
$tests['with no weight 1'] = [
-1,
[
'name' => 'Asana',
],
[
'name' => 'Admin Toolbar',
'weight' => 8,
],
];
$tests['with no weight 2'] = [
1,
[
'name' => 'Asana',
'weight' => 51,
],
[
'name' => 'Admin Toolbar',
],
];
return $tests;
}