function FieldFieldTest::testRevisionComplexRender

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

Tests the output of a revision view with base fields and configurable fields.

File

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

Class

FieldFieldTest
Provides some integration tests for the Field handler.

Namespace

Drupal\Tests\views\Kernel\Handler

Code

public function testRevisionComplexRender() : void {
    $executable = Views::getView('test_field_field_revision_complex_test');
    $executable->execute();
    $this->assertEquals('1', $executable->getStyle()
        ->getField(0, 'id'));
    $this->assertEquals('1', $executable->getStyle()
        ->getField(0, 'revision_id'));
    $this->assertEquals($this->testUsers[0]
        ->getTimeZone(), $executable->getStyle()
        ->getField(0, 'timezone'));
    $this->assertEquals('1, 3, 7', $executable->getStyle()
        ->getField(0, 'field_test_multiple'));
    $this->assertEquals('1', $executable->getStyle()
        ->getField(0, 'field_test_multiple_1'));
    $this->assertEquals('3, 7', $executable->getStyle()
        ->getField(0, 'field_test_multiple_2'));
    $this->assertEquals('1', $executable->getStyle()
        ->getField(1, 'id'));
    $this->assertEquals('2', $executable->getStyle()
        ->getField(1, 'revision_id'));
    $this->assertEquals($this->testUsers[1]
        ->getTimeZone(), $executable->getStyle()
        ->getField(1, 'timezone'));
    $this->assertEquals('0, 3, 5', $executable->getStyle()
        ->getField(1, 'field_test_multiple'));
    $this->assertEquals('0', $executable->getStyle()
        ->getField(1, 'field_test_multiple_1'));
    $this->assertEquals('3, 5', $executable->getStyle()
        ->getField(1, 'field_test_multiple_2'));
    $this->assertEquals('1', $executable->getStyle()
        ->getField(2, 'id'));
    $this->assertEquals('3', $executable->getStyle()
        ->getField(2, 'revision_id'));
    $this->assertEquals($this->testUsers[2]
        ->getTimeZone(), $executable->getStyle()
        ->getField(2, 'timezone'));
    $this->assertEquals('9, 9, 9', $executable->getStyle()
        ->getField(2, 'field_test_multiple'));
    $this->assertEquals('9', $executable->getStyle()
        ->getField(2, 'field_test_multiple_1'));
    $this->assertEquals('9, 9', $executable->getStyle()
        ->getField(2, 'field_test_multiple_2'));
    $this->assertEquals('2', $executable->getStyle()
        ->getField(3, 'id'));
    $this->assertEquals('4', $executable->getStyle()
        ->getField(3, 'revision_id'));
    $this->assertEquals($this->testUsers[3]
        ->getTimeZone(), $executable->getStyle()
        ->getField(3, 'timezone'));
    $this->assertEquals('2, 9, 9', $executable->getStyle()
        ->getField(3, 'field_test_multiple'));
    $this->assertEquals('2', $executable->getStyle()
        ->getField(3, 'field_test_multiple_1'));
    $this->assertEquals('9, 9', $executable->getStyle()
        ->getField(3, 'field_test_multiple_2'));
}

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