You are here

public function ViewsDataTest::testOptionsFieldViewsData in Drupal 9

Same name and namespace in other branches
  1. 8 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 62

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
    ->assertEquals('string_list_field', $test_options_field['argument']['id'], 'Argument handler is properly set for fields with allowed value callbacks.');
  $this
    ->assertEquals('list_field', $test_options_field['filter']['id'], 'Filter handler is properly set for fields with allowed value callbacks.');
}