You are here

protected function HandlerFieldFieldTest::prepareView in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/field/src/Tests/Views/HandlerFieldFieldTest.php \Drupal\field\Tests\Views\HandlerFieldFieldTest::prepareView()

Sets up the testing view with random field data.

Parameters

\Drupal\views\ViewExecutable $view: The view to add field data to.

4 calls to HandlerFieldFieldTest::prepareView()
HandlerFieldFieldTest::_testFormatterSimpleFieldRender in core/modules/field/src/Tests/Views/HandlerFieldFieldTest.php
Tests that fields with formatters runs as expected.
HandlerFieldFieldTest::_testInaccessibleFieldRender in core/modules/field/src/Tests/Views/HandlerFieldFieldTest.php
HandlerFieldFieldTest::_testMultipleFieldRender in core/modules/field/src/Tests/Views/HandlerFieldFieldTest.php
HandlerFieldFieldTest::_testSimpleFieldRender in core/modules/field/src/Tests/Views/HandlerFieldFieldTest.php

File

core/modules/field/src/Tests/Views/HandlerFieldFieldTest.php, line 119
Contains \Drupal\field\Tests\Views\HandlerFieldFieldTest.

Class

HandlerFieldFieldTest
Tests the field itself of the Field integration.

Namespace

Drupal\field\Tests\Views

Code

protected function prepareView(ViewExecutable $view) {
  $view->storage
    ->invalidateCaches();
  $view
    ->initDisplay();
  foreach ($this->fieldStorages as $field_storage) {
    $field_name = $field_storage
      ->getName();
    $view->display_handler->options['fields'][$field_name]['id'] = $field_name;
    $view->display_handler->options['fields'][$field_name]['table'] = 'node__' . $field_name;
    $view->display_handler->options['fields'][$field_name]['field'] = $field_name;
  }
}