function FieldFieldTest::testSimpleExecute

Same name in other branches
  1. 8.9.x core/modules/views/tests/src/Kernel/Handler/FieldFieldTest.php \Drupal\Tests\views\Kernel\Handler\FieldFieldTest::testSimpleExecute()
  2. 10 core/modules/views/tests/src/Kernel/Handler/FieldFieldTest.php \Drupal\Tests\views\Kernel\Handler\FieldFieldTest::testSimpleExecute()
  3. 11.x core/modules/views/tests/src/Kernel/Handler/FieldFieldTest.php \Drupal\Tests\views\Kernel\Handler\FieldFieldTest::testSimpleExecute()

Tests the result of a view with base fields and configurable fields.

File

core/modules/views/tests/src/Kernel/Handler/FieldFieldTest.php, line 234

Class

FieldFieldTest
Provides some integration tests for the Field handler.

Namespace

Drupal\Tests\views\Kernel\Handler

Code

public function testSimpleExecute() {
    $executable = Views::getView('test_field_field_test');
    $executable->execute();
    $this->assertInstanceOf(EntityField::class, $executable->field['id']);
    $this->assertInstanceOf(EntityField::class, $executable->field['field_test']);
    $this->assertIdenticalResultset($executable, [
        [
            'id' => 1,
            'field_test' => 3,
            'user_id' => 2,
        ],
        [
            'id' => 2,
            'field_test' => 0,
            'user_id' => 3,
        ],
        [
            'id' => 3,
            'field_test' => 8,
            'user_id' => 4,
        ],
        [
            'id' => 4,
            'field_test' => 5,
            'user_id' => 5,
        ],
        [
            'id' => 5,
            'field_test' => 6,
            'user_id' => 6,
        ],
    ], [
        'id' => 'id',
        'field_test' => 'field_test',
        'user_id' => 'user_id',
    ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.