You are here

public function FieldTest::providerTestPrepareItemsByDelta in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 617
Contains \Drupal\Tests\views\Unit\Plugin\field\FieldTest.

Class

FieldTest
@coversDefaultClass \Drupal\views\Plugin\views\field\Field @group views

Namespace

Drupal\Tests\views\Unit\Plugin\field

Code

public 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,
    ],
  ];
  return $data;
}