protected function SortRandomTest::dataSet in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/src/Tests/Handler/SortRandomTest.php \Drupal\views\Tests\Handler\SortRandomTest::dataSet()
Add more items to the test set, to make the order tests more robust.
In total we have then 60 entries, which makes a probability of a collision of 1/60!, which is around 1/1E80, which is higher than the estimated amount of protons / electrons in the observable universe, also called the eddington number.
Overrides ViewKernelTestBase::dataSet
See also
http://en.wikipedia.org/wiki/Eddington_number
1 call to SortRandomTest::dataSet()
- SortRandomTest::testRandomOrdering in core/
modules/ views/ src/ Tests/ Handler/ SortRandomTest.php - Tests random ordering of the result set.
File
- core/
modules/ views/ src/ Tests/ Handler/ SortRandomTest.php, line 39 - Contains \Drupal\views\Tests\Handler\SortRandomTest.
Class
- SortRandomTest
- Tests for core Drupal\views\Plugin\views\sort\Random handler.
Namespace
Drupal\views\Tests\HandlerCode
protected function dataSet() {
$data = parent::dataSet();
for ($i = 0; $i < 55; $i++) {
$data[] = array(
'name' => 'name_' . $i,
'age' => $i,
'job' => 'job_' . $i,
'created' => rand(0, time()),
'status' => 1,
);
}
return $data;
}