You are here

public function ViewsDataTest::testOptionsFieldViewsData in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/options/tests/src/Kernel/Views/ViewsDataTest.php \Drupal\Tests\options\Kernel\Views\ViewsDataTest::testOptionsFieldViewsData()

Tests the option module's implementation of hook_field_views_data().

File

core/modules/options/tests/src/Kernel/Views/ViewsDataTest.php, line 57

Class

ViewsDataTest
Test to ensure views data is properly created for the Options module.

Namespace

Drupal\Tests\options\Kernel\Views

Code

public function testOptionsFieldViewsData() {
  $field_data = \Drupal::service('views.views_data')
    ->get('entity_test__test_options');

  // Check that the options module has properly overridden default views data.
  $test_options_field = $field_data['test_options_value'];
  $this
    ->assertEqual($test_options_field['argument']['id'], 'string_list_field', 'Argument handler is properly set for fields with allowed value callbacks.');
  $this
    ->assertEqual($test_options_field['filter']['id'], 'list_field', 'Filter handler is properly set for fields with allowed value callbacks.');
}