You are here

protected function ViewsDataExportAccessTest::getBasicExportView in Views data export 7.3

Build and return a basic view of the views_test table.

Return value

view

1 call to ViewsDataExportAccessTest::getBasicExportView()
ViewsDataExportAccessTest::getExportView in tests/access.test

File

tests/access.test, line 87

Class

ViewsDataExportAccessTest
Test class for access checks for VDE downloads.

Code

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

  // Create the basic view.
  $view = new view();
  $view->vid = 'new';
  $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;
}