public function SortArrayTest::providerSortByWeightElement in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php \Drupal\Tests\Component\Utility\SortArrayTest::providerSortByWeightElement()
Data provider for SortArray::sortByWeightElement().
Return value
array An array of tests, matching the parameter inputs for testSortByWeightElement.
See also
\Drupal\Tests\Component\Utility\SortArrayTest::testSortByWeightElement()
File
- core/
tests/ Drupal/ Tests/ Component/ Utility/ SortArrayTest.php, line 50 - Contains \Drupal\Tests\Component\Utility\SortArrayTest.
Class
- SortArrayTest
- Tests the SortArray component.
Namespace
Drupal\Tests\Component\UtilityCode
public function providerSortByWeightElement() {
$tests = array();
// Weights set and equal.
$tests[] = array(
array(
'weight' => 1,
),
array(
'weight' => 1,
),
0,
);
// Weights set and $a is less (lighter) than $b.
$tests[] = array(
array(
'weight' => 1,
),
array(
'weight' => 2,
),
-1,
);
// Weights set and $a is greater (heavier) than $b.
$tests[] = array(
array(
'weight' => 2,
),
array(
'weight' => 1,
),
1,
);
// Weights not set.
$tests[] = array(
array(),
array(),
0,
);
// Weights for $b not set.
$tests[] = array(
array(
'weight' => 1,
),
array(),
1,
);
// Weights for $a not set.
$tests[] = array(
array(),
array(
'weight' => 1,
),
-1,
);
return $tests;
}