public function FieldFieldTest::testFieldAlias 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::testFieldAlias()
- 10 core/modules/views/tests/src/Kernel/Handler/FieldFieldTest.php \Drupal\Tests\views\Kernel\Handler\FieldFieldTest::testFieldAlias()
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 304
Class
- FieldFieldTest
- Provides some integration tests for the Field handler.
Namespace
Drupal\Tests\views\Kernel\HandlerCode
public function testFieldAlias() {
$executable = Views::getView('test_field_alias_test');
$executable
->execute();
$this
->assertInstanceOf(EntityField::class, $executable->field['id']);
$this
->assertInstanceOf(EntityField::class, $executable->field['name']);
$this
->assertInstanceOf(EntityField::class, $executable->field['name_alias']);
$this
->assertIdenticalResultset($executable, [
[
'id' => 1,
'name' => 'test 0',
'name_alias' => 'test 0',
],
[
'id' => 2,
'name' => 'test 1',
'name_alias' => 'test 1',
],
[
'id' => 3,
'name' => 'test 2',
'name_alias' => 'test 2',
],
[
'id' => 4,
'name' => 'test 3',
'name_alias' => 'test 3',
],
[
'id' => 5,
'name' => 'test 4',
'name_alias' => 'test 4',
],
], [
'id' => 'id',
'name' => 'name',
'name_alias' => 'name_alias',
]);
}