function HandlerTest::viewsData

Same name in this branch
  1. 10 core/modules/views/tests/src/Functional/Handler/HandlerTest.php \Drupal\Tests\views\Functional\Handler\HandlerTest::viewsData()
Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Functional/Handler/HandlerTest.php \Drupal\Tests\views\Functional\Handler\HandlerTest::viewsData()
  2. 9 core/modules/views_ui/tests/src/Functional/HandlerTest.php \Drupal\Tests\views_ui\Functional\HandlerTest::viewsData()
  3. 8.9.x core/modules/views/tests/src/Functional/Handler/HandlerTest.php \Drupal\Tests\views\Functional\Handler\HandlerTest::viewsData()
  4. 8.9.x core/modules/views_ui/tests/src/Functional/HandlerTest.php \Drupal\Tests\views_ui\Functional\HandlerTest::viewsData()
  5. 11.x core/modules/views/tests/src/Functional/Handler/HandlerTest.php \Drupal\Tests\views\Functional\Handler\HandlerTest::viewsData()
  6. 11.x core/modules/views_ui/tests/src/Functional/HandlerTest.php \Drupal\Tests\views_ui\Functional\HandlerTest::viewsData()

Overrides \Drupal\views\Tests\ViewTestBase::viewsData().

Adds:

  • a relationship for the uid column.
  • a dummy field with no help text.

Overrides ViewTestBase::viewsData

File

core/modules/views_ui/tests/src/Functional/HandlerTest.php, line 76

Class

HandlerTest
Tests handler UI for views.

Namespace

Drupal\Tests\views_ui\Functional

Code

protected function viewsData() {
  $data = parent::viewsData();
  $data['views_test_data']['uid'] = [
    'title' => 'UID',
    'help' => 'The test data UID',
    'relationship' => [
      'id' => 'standard',
      'base' => 'users_field_data',
      'base field' => 'uid',
    ],
  ];
  // Create a dummy field with no help text.
  $data['views_test_data']['no_help'] = $data['views_test_data']['name'];
  $data['views_test_data']['no_help']['field']['title'] = 'No help';
  $data['views_test_data']['no_help']['field']['real field'] = 'name';
  unset($data['views_test_data']['no_help']['help']);
  return $data;
}

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