protected function ViewsSqlTest::getBasicView

3.x views_query.test protected ViewsSqlTest::getBasicView()

Build and return a basic view of the views_test table.

Return value

view

4 methods override ViewsSqlTest::getBasicView()
ViewsCacheTest::getBasicView in tests/views_cache.test
Build and return a basic view of the views_test table.
ViewsHandlerFilterCombineTest::getBasicView in tests/handlers/views_handler_filter_combine.test
Build and return a basic view of the views_test table.
ViewsHandlerFilterStringTest::getBasicView in tests/handlers/views_handler_filter_string.test
Build and return a basic view of the views_test table.
ViewsPluginStyleMappingTest::getBasicView in tests/styles/views_plugin_style_mapping.test
Overrides ViewsTestCase::getBasicView().

File

tests/views_query.test, line 365
Tests for Views query features.

Class

ViewsSqlTest

Code

protected function getBasicView() {
  views_include('view');

  // Create the basic view.
  $view = new view();
  $view->name = 'test_view';
  $view->add_display('default');
  $view->base_table = 'views_test';

  // Set up the fields we need.
  $display = $view->new_display('default', 'Master', 'default');
  $display->override_option('fields', array(
    'id' => array(
      'id' => 'id',
      'table' => 'views_test',
      'field' => 'id',
      'relationship' => 'none',
    ),
    'name' => array(
      'id' => 'name',
      'table' => 'views_test',
      'field' => 'name',
      'relationship' => 'none',
    ),
    'age' => array(
      'id' => 'age',
      'table' => 'views_test',
      'field' => 'age',
      'relationship' => 'none',
    ),
  ));

  // Set up the sort order.
  $display->override_option('sorts', array(
    'id' => array(
      'order' => 'ASC',
      'id' => 'id',
      'table' => 'views_test',
      'field' => 'id',
      'relationship' => 'none',
    ),
  ));

  // Set up the pager.
  $display->override_option('pager', array(
    'type' => 'none',
    'options' => array('offset' => 0),
  ));

  return $view;
}