You are here

public function FieldFieldTest::testRevisionExecute in Drupal 9

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

Tests the revision result.

File

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

Class

FieldFieldTest
Provides some integration tests for the Field handler.

Namespace

Drupal\Tests\views\Kernel\Handler

Code

public function testRevisionExecute() {
  $executable = Views::getView('test_field_field_revision_test');
  $executable
    ->execute();
  $this
    ->assertInstanceOf(EntityField::class, $executable->field['name']);
  $this
    ->assertInstanceOf(EntityField::class, $executable->field['field_test']);
  $this
    ->assertIdenticalResultset($executable, [
    [
      'id' => 1,
      'field_test' => 1,
      'revision_id' => 1,
      'name' => 'base value',
    ],
    [
      'id' => 1,
      'field_test' => 2,
      'revision_id' => 2,
      'name' => 'revision value1',
    ],
    [
      'id' => 1,
      'field_test' => 3,
      'revision_id' => 3,
      'name' => 'revision value2',
    ],
    [
      'id' => 2,
      'field_test' => 4,
      'revision_id' => 4,
      'name' => 'next entity value',
    ],
  ], [
    'entity_test_rev_revision_id' => 'id',
    'revision_id' => 'revision_id',
    'name' => 'name',
    'field_test' => 'field_test',
  ]);
}