function TagTest::testViewsUiAutocompleteIndividualTags

Same name and namespace in other branches
  1. 9 core/modules/views_ui/tests/src/Kernel/TagTest.php \Drupal\Tests\views_ui\Kernel\TagTest::testViewsUiAutocompleteIndividualTags()
  2. 10 core/modules/views_ui/tests/src/Kernel/TagTest.php \Drupal\Tests\views_ui\Kernel\TagTest::testViewsUiAutocompleteIndividualTags()
  3. 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\Kernel

Code

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.