function ViewsDataTest::viewsData

Same name in other branches
  1. 9 core/modules/views/tests/src/Unit/ViewsDataTest.php \Drupal\Tests\views\Unit\ViewsDataTest::viewsData()
  2. 10 core/modules/views/tests/src/Unit/ViewsDataTest.php \Drupal\Tests\views\Unit\ViewsDataTest::viewsData()
  3. 11.x core/modules/views/tests/src/Unit/ViewsDataTest.php \Drupal\Tests\views\Unit\ViewsDataTest::viewsData()

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.