function FieldTest::providerTestPrepareItemsByDelta
Same name in other branches
- 9 core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php \Drupal\Tests\views\Unit\Plugin\field\FieldTest::providerTestPrepareItemsByDelta()
- 8.9.x core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php \Drupal\Tests\views\Unit\Plugin\field\FieldTest::providerTestPrepareItemsByDelta()
- 11.x core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php \Drupal\Tests\views\Unit\Plugin\field\FieldTest::providerTestPrepareItemsByDelta()
Provides test data for testPrepareItemsByDelta().
File
-
core/
modules/ views/ tests/ src/ Unit/ Plugin/ field/ FieldTest.php, line 642
Class
- FieldTest
- @coversDefaultClass \Drupal\views\Plugin\views\field\EntityField @group views
Namespace
Drupal\Tests\views\Unit\Plugin\fieldCode
public static function providerTestPrepareItemsByDelta() {
$data = [];
// Let's display all values.
$data[] = [
[],
[
3,
1,
4,
1,
5,
9,
],
];
// Test just reversed deltas.
$data[] = [
[
'delta_reversed' => TRUE,
],
[
9,
5,
1,
4,
1,
3,
],
];
// Test combinations of delta limit, offset and first_last.
$data[] = [
[
'group_rows' => TRUE,
'delta_limit' => 3,
],
[
3,
1,
4,
],
];
$data[] = [
[
'group_rows' => TRUE,
'delta_limit' => 3,
'delta_offset' => 2,
],
[
4,
1,
5,
],
];
$data[] = [
[
'group_rows' => TRUE,
'delta_reversed' => TRUE,
'delta_limit' => 3,
'delta_offset' => 2,
],
[
1,
4,
1,
],
];
$data[] = [
[
'group_rows' => TRUE,
'delta_first_last' => TRUE,
],
[
3,
9,
],
];
$data[] = [
[
'group_rows' => TRUE,
'delta_limit' => 1,
'delta_first_last' => TRUE,
],
[
3,
],
];
$data[] = [
[
'group_rows' => TRUE,
'delta_offset' => 1,
'delta_first_last' => TRUE,
],
[
1,
9,
],
];
// Test with string values where we would expect integers to be provided.
$data[] = [
[
'group_rows' => TRUE,
'delta_limit' => 'All',
],
[
3,
1,
4,
1,
5,
9,
],
];
$data[] = [
[
'group_rows' => TRUE,
'delta_limit' => 'three',
],
[
3,
1,
4,
1,
5,
9,
],
];
$data[] = [
[
'group_rows' => TRUE,
'delta_limit' => 'three',
'delta_offset' => 'two',
],
[
3,
1,
4,
1,
5,
9,
],
];
return $data;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.