public function FieldFieldTest::testComplexExecute in Drupal 9
Same name and namespace in other branches
- 8 core/modules/views/tests/src/Kernel/Handler/FieldFieldTest.php \Drupal\Tests\views\Kernel\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/ tests/ src/ Kernel/ Handler/ FieldFieldTest.php, line 348
Class
- FieldFieldTest
- Provides some integration tests for the Field handler.
Namespace
Drupal\Tests\views\Kernel\HandlerCode
public function testComplexExecute() {
$executable = Views::getView('test_field_field_complex_test');
$executable
->execute();
$timezones = [];
foreach ($this->testUsers as $user) {
$timezones[] = $user
->getTimeZone();
}
$this
->assertInstanceOf(EntityField::class, $executable->field['field_test_multiple']);
$this
->assertInstanceOf(EntityField::class, $executable->field['field_test_multiple_1']);
$this
->assertInstanceOf(EntityField::class, $executable->field['field_test_multiple_2']);
$this
->assertInstanceOf(EntityField::class, $executable->field['timezone']);
$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',
]);
}