function HandlerFieldFieldTest::doTestSimpleFieldRender

Same name in other branches
  1. 8.9.x core/modules/field/tests/src/Kernel/Views/HandlerFieldFieldTest.php \Drupal\Tests\field\Kernel\Views\HandlerFieldFieldTest::doTestSimpleFieldRender()
  2. 10 core/modules/field/tests/src/Kernel/Views/HandlerFieldFieldTest.php \Drupal\Tests\field\Kernel\Views\HandlerFieldFieldTest::doTestSimpleFieldRender()
  3. 11.x core/modules/field/tests/src/Kernel/Views/HandlerFieldFieldTest.php \Drupal\Tests\field\Kernel\Views\HandlerFieldFieldTest::doTestSimpleFieldRender()

Tests simple field rendering.

1 call to HandlerFieldFieldTest::doTestSimpleFieldRender()
HandlerFieldFieldTest::testFieldRender in core/modules/field/tests/src/Kernel/Views/HandlerFieldFieldTest.php
Tests fields rendering in views.

File

core/modules/field/tests/src/Kernel/Views/HandlerFieldFieldTest.php, line 107

Class

HandlerFieldFieldTest
Tests the field rendering in views.

Namespace

Drupal\Tests\field\Kernel\Views

Code

public function doTestSimpleFieldRender() {
    $view = Views::getView('test_view_fieldapi');
    $this->prepareView($view);
    $view->preview();
    // Tests that the rendered fields match the actual value of the fields.
    for ($i = 0; $i < 3; $i++) {
        for ($key = 0; $key < 2; $key++) {
            $field_name = $this->fieldStorages[$key]
                ->getName();
            $rendered_field = $view->style_plugin
                ->getField($i, $field_name);
            $expected_field = $this->nodes[$i]->{$field_name}->value;
            $this->assertEquals($expected_field, $rendered_field);
        }
    }
}

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