You are here

public function FieldFieldTest::testSimpleExecute in Zircon Profile 8.0

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

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

File

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

Class

FieldFieldTest
Provides some integration tests for the Field handler.

Namespace

Drupal\views\Tests\Handler

Code

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