function ViewsDataTest::testOptionsFieldViewsData

Same name in other branches
  1. 9 core/modules/options/tests/src/Kernel/Views/ViewsDataTest.php \Drupal\Tests\options\Kernel\Views\ViewsDataTest::testOptionsFieldViewsData()
  2. 8.9.x core/modules/options/tests/src/Kernel/Views/ViewsDataTest.php \Drupal\Tests\options\Kernel\Views\ViewsDataTest::testOptionsFieldViewsData()
  3. 10 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 69

Class

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

Namespace

Drupal\Tests\options\Kernel\Views

Code

public function testOptionsFieldViewsData() : void {
    $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.');
}

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