function FilterStringTest::getGroupedExposedFilters

Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Kernel/Handler/FilterStringTest.php \Drupal\Tests\views\Kernel\Handler\FilterStringTest::getGroupedExposedFilters()
  2. 10 core/modules/views/tests/src/Kernel/Handler/FilterStringTest.php \Drupal\Tests\views\Kernel\Handler\FilterStringTest::getGroupedExposedFilters()
  3. 11.x core/modules/views/tests/src/Kernel/Handler/FilterStringTest.php \Drupal\Tests\views\Kernel\Handler\FilterStringTest::getGroupedExposedFilters()
12 calls to FilterStringTest::getGroupedExposedFilters()
FilterStringTest::testFilterStringGroupedExposedContains in core/modules/views/tests/src/Kernel/Handler/FilterStringTest.php
FilterStringTest::testFilterStringGroupedExposedEmpty in core/modules/views/tests/src/Kernel/Handler/FilterStringTest.php
FilterStringTest::testFilterStringGroupedExposedEnds in core/modules/views/tests/src/Kernel/Handler/FilterStringTest.php
FilterStringTest::testFilterStringGroupedExposedEqual in core/modules/views/tests/src/Kernel/Handler/FilterStringTest.php
FilterStringTest::testFilterStringGroupedExposedLonger in core/modules/views/tests/src/Kernel/Handler/FilterStringTest.php

... See full list

File

core/modules/views/tests/src/Kernel/Handler/FilterStringTest.php, line 784

Class

FilterStringTest
Tests the core <a href="/api/drupal/core%21modules%21views%21src%21Plugin%21views%21filter%21StringFilter.php/class/StringFilter/8.9.x" title="Basic textfield filter to handle string filtering commands including equality, like, not like, etc." class="local">Drupal\views\Plugin\views\filter\StringFilter</a> handler.

Namespace

Drupal\Tests\views\Kernel\Handler

Code

protected function getGroupedExposedFilters() {
    $filters = [
        'name' => [
            'id' => 'name',
            'plugin_id' => 'string',
            'table' => 'views_test_data',
            'field' => 'name',
            'relationship' => 'none',
            'exposed' => TRUE,
            'expose' => [
                'operator' => 'name_op',
                'label' => 'name',
                'identifier' => 'name',
            ],
            'is_grouped' => TRUE,
            'group_info' => [
                'label' => 'name',
                'identifier' => 'name',
                'default_group' => 'All',
                'group_items' => [
                    1 => [
                        'title' => 'Is Ringo',
                        'operator' => '=',
                        'value' => 'Ringo',
                    ],
                    2 => [
                        'title' => 'Is not Ringo',
                        'operator' => '!=',
                        'value' => 'Ringo',
                    ],
                    3 => [
                        'title' => 'Contains ing',
                        'operator' => 'contains',
                        'value' => 'ing',
                    ],
                    4 => [
                        'title' => 'Shorter than 5 letters',
                        'operator' => 'shorterthan',
                        'value' => 5,
                    ],
                    5 => [
                        'title' => 'Longer than 7 letters',
                        'operator' => 'longerthan',
                        'value' => 7,
                    ],
                ],
            ],
        ],
        'description' => [
            'id' => 'description',
            'plugin_id' => 'string',
            'table' => 'views_test_data',
            'field' => 'description',
            'relationship' => 'none',
            'exposed' => TRUE,
            'expose' => [
                'operator' => 'description_op',
                'label' => 'description',
                'identifier' => 'description',
            ],
            'is_grouped' => TRUE,
            'group_info' => [
                'label' => 'description',
                'identifier' => 'description',
                'default_group' => 'All',
                'group_items' => [
                    1 => [
                        'title' => 'Contains the word: Actor',
                        'operator' => 'word',
                        'value' => 'actor',
                    ],
                    2 => [
                        'title' => 'Starts with George',
                        'operator' => 'starts',
                        'value' => 'George',
                    ],
                    3 => [
                        'title' => 'Not Starts with: George',
                        'operator' => 'not_starts',
                        'value' => 'George',
                    ],
                    4 => [
                        'title' => 'Ends with: Beatles',
                        'operator' => 'ends',
                        'value' => 'Beatles.',
                    ],
                    5 => [
                        'title' => 'Not Ends with: Beatles',
                        'operator' => 'not_ends',
                        'value' => 'Beatles.',
                    ],
                    6 => [
                        'title' => 'Does not contain: Beatles',
                        'operator' => 'not',
                        'value' => 'Beatles.',
                    ],
                    7 => [
                        'title' => 'Empty description',
                        'operator' => 'empty',
                        'value' => '',
                    ],
                ],
            ],
        ],
    ];
    return $filters;
}

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