You are here

function ViewsNodeRevisionRelationsTestCase::test_view_node_revision_vid in Views (for Drupal 7) 7.3

Test view with default join on node.vid.

1 call to ViewsNodeRevisionRelationsTestCase::test_view_node_revision_vid()
ViewsNodeRevisionRelationsTestCase::testNodeRevisionRelationship in tests/node/views_node_revision_relations.test
Create a node with revision and rest result count for both views.

File

tests/node/views_node_revision_relations.test, line 125
Definition of ViewsNodeRevisionRelationsTestCase.

Class

ViewsNodeRevisionRelationsTestCase
Tests basic node_revision table integration into views.

Code

function test_view_node_revision_vid() {
  $view = new view();
  $view->name = 'test_node_revision_vid';
  $view->description = '';
  $view->tag = '';
  $view->base_table = 'node_revision';
  $view->human_name = 'Test node revision vid';
  $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['use_more_always'] = FALSE;
  $handler->display->display_options['access']['type'] = 'perm';
  $handler->display->display_options['access']['perm'] = 'view revisions';
  $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';

  /* Relationship: Content revision: Content */
  $handler->display->display_options['relationships']['vid']['id'] = 'vid';
  $handler->display->display_options['relationships']['vid']['table'] = 'node_revision';
  $handler->display->display_options['relationships']['vid']['field'] = 'vid';
  $handler->display->display_options['relationships']['vid']['label'] = 'VID';
  $handler->display->display_options['relationships']['vid']['required'] = TRUE;

  /* Field: Content revision: Vid */
  $handler->display->display_options['fields']['vid']['id'] = 'vid';
  $handler->display->display_options['fields']['vid']['table'] = 'node_revision';
  $handler->display->display_options['fields']['vid']['field'] = 'vid';

  /* Field: Content revision: Nid */
  $handler->display->display_options['fields']['nid_1']['id'] = 'nid_1';
  $handler->display->display_options['fields']['nid_1']['table'] = 'node_revision';
  $handler->display->display_options['fields']['nid_1']['field'] = 'nid';

  /* Field: Content: Nid */
  $handler->display->display_options['fields']['nid']['id'] = 'nid';
  $handler->display->display_options['fields']['nid']['table'] = 'node';
  $handler->display->display_options['fields']['nid']['field'] = 'nid';
  $handler->display->display_options['fields']['nid']['relationship'] = 'vid';

  /* Contextual filter: Content revision: Nid */
  $handler->display->display_options['arguments']['nid']['id'] = 'nid';
  $handler->display->display_options['arguments']['nid']['table'] = 'node_revision';
  $handler->display->display_options['arguments']['nid']['field'] = 'nid';
  $handler->display->display_options['arguments']['nid']['default_argument_type'] = 'fixed';
  $handler->display->display_options['arguments']['nid']['summary']['number_of_records'] = '0';
  $handler->display->display_options['arguments']['nid']['summary']['format'] = 'default_summary';
  $handler->display->display_options['arguments']['nid']['summary_options']['items_per_page'] = '25';
  return $view;
}