You are here

protected function HandlerTest::viewsData in Drupal 8

Same name in this branch
  1. 8 core/modules/views_ui/tests/src/Functional/HandlerTest.php \Drupal\Tests\views_ui\Functional\HandlerTest::viewsData()
  2. 8 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_ui/tests/src/Functional/HandlerTest.php \Drupal\Tests\views_ui\Functional\HandlerTest::viewsData()
  2. 10 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 74

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' => t('UID'),
    'help' => t('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'] = t('No help');
  $data['views_test_data']['no_help']['field']['real field'] = 'name';
  unset($data['views_test_data']['no_help']['help']);
  return $data;
}