function TagTest::testViewsUiAutocompleteIndividualTags
Same name in other branches
- 8.9.x core/modules/views_ui/tests/src/Kernel/TagTest.php \Drupal\Tests\views_ui\Kernel\TagTest::testViewsUiAutocompleteIndividualTags()
- 10 core/modules/views_ui/tests/src/Kernel/TagTest.php \Drupal\Tests\views_ui\Kernel\TagTest::testViewsUiAutocompleteIndividualTags()
- 11.x core/modules/views_ui/tests/src/Kernel/TagTest.php \Drupal\Tests\views_ui\Kernel\TagTest::testViewsUiAutocompleteIndividualTags()
Tests that comma delimited tags are treated as individual tags.
@dataProvider providerViewsUiAutocompleteIndividualTags
File
-
core/
modules/ views_ui/ tests/ src/ Kernel/ TagTest.php, line 76
Class
- TagTest
- Tests the views ui tagging functionality.
Namespace
Drupal\Tests\views_ui\KernelCode
public function testViewsUiAutocompleteIndividualTags($expected_tag, $search_string) {
$controller = ViewsUIController::create($this->container);
$request = $this->container
->get('request_stack')
->getCurrentRequest();
$tag = 'comma, 你好, Foo bar';
View::create([
'tag' => $tag,
'id' => $this->randomMachineName(),
])
->save();
$request->query
->set('q', $search_string);
$result = $controller->autocompleteTag($request);
$matches = (array) json_decode($result->getContent());
$this->assertCount(1, $matches);
$this->assertSame($expected_tag, $matches[0]->value);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.