1 field_views.test protected FieldViewsFieldTest::getFieldView()

File

core/modules/field/tests/field_views.test, line 449
Tests the Views integration with Field API.

Class

FieldViewsFieldTest
Tests the field_field handler. @TODO Check a entity-type with bundles Check a entity-type without bundles Check locale:disabled, locale:enabled and locale:enabled with another language Check revisions

Code

protected function getFieldView() {
  $view = new view;
  $view->name = 'view_fieldapi';
  $view->description = '';
  $view->tag = 'default';
  $view->base_table = 'node';
  $view->human_name = 'view_fieldapi';
  $view->core = 7;
  $view->api_version = '3.0';
  $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

  /* Display: Master */
  $handler = $view->new_display('default', 'Master', 'default');
  $handler->display->display_options['access']['type'] = 'perm';
  $handler->display->display_options['cache']['type'] = 'none';
  $handler->display->display_options['query']['type'] = 'views_query';
  $handler->display->display_options['exposed_form']['type'] = 'basic';
  $handler->display->display_options['pager']['type'] = 'full';
  $handler->display->display_options['style_plugin'] = 'default';
  $handler->display->display_options['row_plugin'] = 'fields';

  $handler->display->display_options['fields']['nid']['id'] = 'nid';
  $handler->display->display_options['fields']['nid']['table'] = 'node';
  $handler->display->display_options['fields']['nid']['field'] = 'nid';
  foreach ($this->fields as $key => $field) {
    $handler->display->display_options['fields'][$field['field_name']]['id'] = $field['field_name'];
    $handler->display->display_options['fields'][$field['field_name']]['table'] = 'field_data_' . $field['field_name'];
    $handler->display->display_options['fields'][$field['field_name']]['field'] = $field['field_name'];
  }
  return $view;
}