function ConnectionTest::provideQueriesToTrim

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Database/ConnectionTest.php \Drupal\Tests\Core\Database\ConnectionTest::provideQueriesToTrim()
  2. 8.9.x core/tests/Drupal/Tests/Core/Database/ConnectionTest.php \Drupal\Tests\Core\Database\ConnectionTest::provideQueriesToTrim()
  3. 10 core/tests/Drupal/Tests/Core/Database/ConnectionTest.php \Drupal\Tests\Core\Database\ConnectionTest::provideQueriesToTrim()

Data provider for testQueryTrim().

Return value

array Array of arrays with the following elements:

  • Expected trimmed query.
  • Padded query.
  • Query options.

File

core/tests/Drupal/Tests/Core/Database/ConnectionTest.php, line 630

Class

ConnectionTest
Tests the Connection class.

Namespace

Drupal\Tests\Core\Database

Code

public static function provideQueriesToTrim() {
    return [
        'remove_non_breaking_space' => [
            'SELECT * FROM test',
            "SELECT * FROM test\xa0",
            [],
        ],
        'remove_ordinary_space' => [
            'SELECT * FROM test',
            'SELECT * FROM test ',
            [],
        ],
        'remove_semicolon' => [
            'SELECT * FROM test',
            'SELECT * FROM test;',
            [],
        ],
        'keep_trailing_semicolon' => [
            'SELECT * FROM test;',
            'SELECT * FROM test;',
            [
                'allow_delimiter_in_query' => TRUE,
            ],
        ],
        'remove_semicolon_with_whitespace' => [
            'SELECT * FROM test',
            'SELECT * FROM test; ',
            [],
        ],
        'keep_trailing_semicolon_with_whitespace' => [
            'SELECT * FROM test;',
            'SELECT * FROM test; ',
            [
                'allow_delimiter_in_query' => TRUE,
            ],
        ],
    ];
}

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