function SelectTest::providerRegularExpressionCondition

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Database/SelectTest.php \Drupal\KernelTests\Core\Database\SelectTest::providerRegularExpressionCondition()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Database/SelectTest.php \Drupal\KernelTests\Core\Database\SelectTest::providerRegularExpressionCondition()
  3. 11.x core/tests/Drupal/KernelTests/Core/Database/SelectTest.php \Drupal\KernelTests\Core\Database\SelectTest::providerRegularExpressionCondition()

Data provider for testRegularExpressionCondition().

Return value

array[] Returns data-set elements with:

  • the expected result of the query
  • the table column to do the search on.
  • the regular expression pattern to search for.
  • the regular expression operator 'REGEXP' or 'NOT REGEXP'.

File

core/tests/Drupal/KernelTests/Core/Database/SelectTest.php, line 503

Class

SelectTest
Tests the Select query builder.

Namespace

Drupal\KernelTests\Core\Database

Code

public static function providerRegularExpressionCondition() {
    return [
        [
            [
                'John',
            ],
            'name',
            'hn$',
            'REGEXP',
        ],
        [
            [
                'Paul',
            ],
            'name',
            '^Pau',
            'REGEXP',
        ],
        [
            [
                'George',
                'Ringo',
            ],
            'name',
            'Ringo|George',
            'REGEXP',
        ],
        [
            [
                'Pete',
            ],
            'job',
            '#Drummer',
            'REGEXP',
        ],
        [
            [],
            'job',
            '#Singer',
            'REGEXP',
        ],
        [
            [
                'Paul',
                'Pete',
            ],
            'age',
            '2[6]',
            'REGEXP',
        ],
        [
            [
                'George',
                'Paul',
                'Pete',
                'Ringo',
            ],
            'name',
            'hn$',
            'NOT REGEXP',
        ],
        [
            [
                'George',
                'John',
                'Pete',
                'Ringo',
            ],
            'name',
            '^Pau',
            'NOT REGEXP',
        ],
        [
            [
                'John',
                'Paul',
                'Pete',
            ],
            'name',
            'Ringo|George',
            'NOT REGEXP',
        ],
        [
            [
                'George',
                'John',
                'Paul',
                'Ringo',
            ],
            'job',
            '#Drummer',
            'NOT REGEXP',
        ],
        [
            [
                'George',
                'John',
                'Paul',
                'Pete',
                'Ringo',
            ],
            'job',
            '#Singer',
            'NOT REGEXP',
        ],
        [
            [
                'George',
                'John',
                'Ringo',
            ],
            'age',
            '2[6]',
            'NOT REGEXP',
        ],
    ];
}

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