You are here

protected function ViewsSqlTest::viewsData in Views (for Drupal 7) 6.3

Same name and namespace in other branches
  1. 7.3 tests/views_query.test \ViewsSqlTest::viewsData()

The views data definition.

1 call to ViewsSqlTest::viewsData()
ViewsSqlTest::setUp in tests/views_query.test
Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix.…

File

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

Class

ViewsSqlTest

Code

protected function viewsData() {

  // Declaration of the base table.
  $data['views_test']['table'] = array(
    'group' => t('Views test'),
    'base' => array(
      'field' => 'id',
      'title' => t('Views test'),
      'help' => t('Users who have created accounts on your site.'),
    ),
  );

  // Declaration of fields.
  $data['views_test']['id'] = array(
    'title' => t('ID'),
    'help' => t('The test data ID'),
    'field' => array(
      'handler' => 'views_handler_field_numeric',
      'click sortable' => TRUE,
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_numeric',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );
  $data['views_test']['name'] = array(
    'title' => t('Name'),
    'help' => t('The name of the person'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_string',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );
  $data['views_test']['age'] = array(
    'title' => t('Age'),
    'help' => t('The age of the person'),
    'field' => array(
      'handler' => 'views_handler_field_numeric',
      'click sortable' => TRUE,
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_numeric',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );
  $data['views_test']['job'] = array(
    'title' => t('Job'),
    'help' => t('The job of the person'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_string',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );
  $data['views_test']['created'] = array(
    'title' => t('Created'),
    'help' => t('The creation date of this record'),
    'field' => array(
      'handler' => 'views_handler_field_date',
      'click sortable' => TRUE,
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_date',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_date',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort_date',
    ),
  );
  return $data;
}