protected function ViewsCacheTest::getBasicView

3.x views_cache.test protected ViewsCacheTest::getBasicView()

Build and return a basic view of the views_test table.

Return value

view

Overrides ViewsSqlTest::getBasicView

3 calls to ViewsCacheTest::getBasicView()
ViewsCacheTest::testHeaderStorage in tests/views_cache.test
Tests css/js storage and restoring mechanism.
ViewsCacheTest::testNoneCaching in tests/views_cache.test
Tests no caching.
ViewsCacheTest::testTimeCaching in tests/views_cache.test
Tests time based caching.

File

tests/views_cache.test, line 27
Definition of ViewsCacheTest.

Class

ViewsCacheTest
Basic test for pluggable caching.

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',
    ),
  ));

  return $view;
}