function SortArrayTest::providerSortByWeightProperty
Same name in other branches
- 9 core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php \Drupal\Tests\Component\Utility\SortArrayTest::providerSortByWeightProperty()
- 8.9.x core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php \Drupal\Tests\Component\Utility\SortArrayTest::providerSortByWeightProperty()
- 11.x core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php \Drupal\Tests\Component\Utility\SortArrayTest::providerSortByWeightProperty()
Data provider for SortArray::sortByWeightProperty().
Return value
array An array of tests, matching the parameter inputs for testSortByWeightProperty.
See also
\Drupal\Tests\Component\Utility\SortArrayTest::testSortByWeightProperty()
File
-
core/
tests/ Drupal/ Tests/ Component/ Utility/ SortArrayTest.php, line 123
Class
- SortArrayTest
- Tests the SortArray component.
Namespace
Drupal\Tests\Component\UtilityCode
public static function providerSortByWeightProperty() {
$tests = [];
// Weights set and equal.
$tests[] = [
[
'#weight' => 1,
],
[
'#weight' => 1,
],
0,
];
// Weights set and $a is less (lighter) than $b.
$tests[] = [
[
'#weight' => 1,
],
[
'#weight' => 2,
],
-1,
];
// Weights set and $a is greater (heavier) than $b.
$tests[] = [
[
'#weight' => 2,
],
[
'#weight' => 1,
],
1,
];
// Weights not set.
$tests[] = [
[],
[],
0,
];
// Weights for $b not set.
$tests[] = [
[
'#weight' => 1,
],
[],
1,
];
// Weights for $a not set.
$tests[] = [
[],
[
'#weight' => 1,
],
-1,
];
return $tests;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.