function ViewsDataHelperTest::viewsData

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

Returns the views data definition.

Return value

array

1 call to ViewsDataHelperTest::viewsData()
ViewsDataHelperTest::testFetchFields in core/modules/views/tests/src/Unit/ViewsDataHelperTest.php
Tests fetchFields.

File

core/modules/views/tests/src/Unit/ViewsDataHelperTest.php, line 22

Class

ViewsDataHelperTest
@coversDefaultClass \Drupal\views\ViewsDataHelper @group views

Namespace

Drupal\Tests\views\Unit

Code

protected function viewsData() {
    $data = ViewTestData::viewsData();
    // Tweak the views data to have a base for testing
    // \Drupal\views\ViewsDataHelper::fetchFields().
    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',
    ];
    return $data;
}

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