You are here

public function FieldFieldTest::testComplexExecute in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Tests/Handler/FieldFieldTest.php \Drupal\views\Tests\Handler\FieldFieldTest::testComplexExecute()

Tests the result of a view with complex field configuration.

A complex field configuration contains multiple times the same field, with different delta limit / offset.

File

core/modules/views/src/Tests/Handler/FieldFieldTest.php, line 343
Contains \Drupal\views\Tests\Handler\FieldFieldTest.

Class

FieldFieldTest
Provides some integration tests for the Field handler.

Namespace

Drupal\views\Tests\Handler

Code

public function testComplexExecute() {
  $executable = Views::getView('test_field_field_complex_test');
  $executable
    ->execute();
  $timezones = [];
  foreach ($this->testUsers as $user) {
    $timezones[] = $user
      ->getTimeZone();
  }
  $this
    ->assertTrue($executable->field['field_test_multiple'] instanceof Field);
  $this
    ->assertTrue($executable->field['field_test_multiple_1'] instanceof Field);
  $this
    ->assertTrue($executable->field['field_test_multiple_2'] instanceof Field);
  $this
    ->assertTrue($executable->field['timezone'] instanceof Field);
  $this
    ->assertIdenticalResultset($executable, [
    [
      'timezone' => $timezones[0],
      'field_test_multiple' => [
        1,
        3,
      ],
      'field_test_multiple_1' => [
        1,
        3,
      ],
      'field_test_multiple_2' => [
        1,
        3,
      ],
    ],
    [
      'timezone' => $timezones[1],
      'field_test_multiple' => [
        7,
        0,
      ],
      'field_test_multiple_1' => [
        7,
        0,
      ],
      'field_test_multiple_2' => [
        7,
        0,
      ],
    ],
    [
      'timezone' => $timezones[2],
      'field_test_multiple' => [
        3,
        5,
      ],
      'field_test_multiple_1' => [
        3,
        5,
      ],
      'field_test_multiple_2' => [
        3,
        5,
      ],
    ],
    [
      'timezone' => $timezones[3],
      'field_test_multiple' => [
        9,
        9,
      ],
      'field_test_multiple_1' => [
        9,
        9,
      ],
      'field_test_multiple_2' => [
        9,
        9,
      ],
    ],
    [
      'timezone' => $timezones[4],
      'field_test_multiple' => [
        9,
        0,
      ],
      'field_test_multiple_1' => [
        9,
        0,
      ],
      'field_test_multiple_2' => [
        9,
        0,
      ],
    ],
  ], [
    'timezone' => 'timezone',
    'field_test_multiple' => 'field_test_multiple',
    'field_test_multiple_1' => 'field_test_multiple_1',
    'field_test_multiple_2' => 'field_test_multiple_2',
  ]);
}