You are here

public static function ViewTestData::viewsData in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/src/Tests/ViewTestData.php \Drupal\views\Tests\ViewTestData::viewsData()

Returns the views data definition.

4 calls to ViewTestData::viewsData()
PreviewTest::viewsData in core/modules/views_ui/tests/src/FunctionalJavascript/PreviewTest.php
Returns the views data definition.
ViewsDataHelperTest::viewsData in core/modules/views/tests/src/Unit/ViewsDataHelperTest.php
Returns the views data definition.
ViewsKernelTestBase::viewsData in core/modules/views/tests/src/Kernel/ViewsKernelTestBase.php
Returns the views data definition.
ViewTestBase::viewsData in core/modules/views/tests/src/Functional/ViewTestBase.php
Returns the views data definition.

File

core/modules/views/src/Tests/ViewTestData.php, line 123

Class

ViewTestData
Provides tests view data and the base test schema with sample data records.

Namespace

Drupal\views\Tests

Code

public static function viewsData() {

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

  // Declaration of fields.
  $data['views_test_data']['id'] = [
    'title' => 'ID',
    'help' => 'The test data ID',
    'field' => [
      'id' => 'numeric',
    ],
    'argument' => [
      'id' => 'numeric',
    ],
    'filter' => [
      'id' => 'numeric',
    ],
    'sort' => [
      'id' => 'standard',
    ],
  ];
  $data['views_test_data']['name'] = [
    'title' => 'Name',
    'help' => 'The name of the person',
    'field' => [
      'id' => 'standard',
    ],
    'argument' => [
      'id' => 'string',
    ],
    'filter' => [
      'id' => 'string',
    ],
    'sort' => [
      'id' => 'standard',
    ],
  ];
  $data['views_test_data']['age'] = [
    'title' => 'Age',
    'help' => 'The age of the person',
    'field' => [
      'id' => 'numeric',
    ],
    'argument' => [
      'id' => 'numeric',
    ],
    'filter' => [
      'id' => 'numeric',
    ],
    'sort' => [
      'id' => 'standard',
    ],
  ];
  $data['views_test_data']['job'] = [
    'title' => 'Job',
    'help' => 'The job of the person',
    'field' => [
      'id' => 'standard',
    ],
    'argument' => [
      'id' => 'string',
    ],
    'filter' => [
      'id' => 'string',
    ],
    'sort' => [
      'id' => 'standard',
    ],
  ];
  $data['views_test_data']['created'] = [
    'title' => 'Created',
    'help' => 'The creation date of this record',
    'field' => [
      'id' => 'date',
    ],
    'argument' => [
      'id' => 'date',
    ],
    'filter' => [
      'id' => 'date',
    ],
    'sort' => [
      'id' => 'date',
    ],
  ];
  $data['views_test_data']['status'] = [
    'title' => 'Status',
    'help' => 'The status of this record',
    'field' => [
      'id' => 'boolean',
    ],
    'filter' => [
      'id' => 'boolean',
    ],
    'sort' => [
      'id' => 'standard',
    ],
  ];
  return $data;
}