You are here

protected function ViewsDataTest::viewsData in Drupal 8

Returns the views data definition.

3 calls to ViewsDataTest::viewsData()
ViewsDataTest::setupMockedModuleHandler in core/modules/views/tests/src/Unit/ViewsDataTest.php
Mocks the basic module handler used for the test.
ViewsDataTest::testFullAndTableGetCache in core/modules/views/tests/src/Unit/ViewsDataTest.php
Tests the cache of the full and single table data.
ViewsDataTest::viewsDataWithProvider in core/modules/views/tests/src/Unit/ViewsDataTest.php
Returns the views data definition with the provider key.

File

core/modules/views/tests/src/Unit/ViewsDataTest.php, line 81

Class

ViewsDataTest
@coversDefaultClass \Drupal\views\ViewsData @group views

Namespace

Drupal\Tests\views\Unit

Code

protected function viewsData() {
  $data = ViewTestData::viewsData();

  // Tweak the views data to have a base for testing.
  unset($data['views_test_data']['id']['field']);
  unset($data['views_test_data']['name']['argument']);
  unset($data['views_test_data']['age']['filter']);
  unset($data['views_test_data']['job']['sort']);
  $data['views_test_data']['created']['area']['id'] = 'text';
  $data['views_test_data']['age']['area']['id'] = 'text';
  $data['views_test_data']['age']['area']['sub_type'] = 'header';
  $data['views_test_data']['job']['area']['id'] = 'text';
  $data['views_test_data']['job']['area']['sub_type'] = [
    'header',
    'footer',
  ];

  // Duplicate the example views test data for different weight, different title,
  // and matching data.
  $data['views_test_data_2'] = $data['views_test_data'];
  $data['views_test_data_2']['table']['base']['weight'] = 50;
  $data['views_test_data_3'] = $data['views_test_data'];
  $data['views_test_data_3']['table']['base']['weight'] = -50;
  $data['views_test_data_4'] = $data['views_test_data'];
  $data['views_test_data_4']['table']['base']['title'] = 'A different title';
  $data['views_test_data_5'] = $data['views_test_data'];
  $data['views_test_data_5']['table']['base']['title'] = 'Z different title';
  $data['views_test_data_6'] = $data['views_test_data'];
  return $data;
}