function ConnectionTest::provideQueriesToTrim

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

Dataprovider 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 330

Class

ConnectionTest
Tests the Connection class.

Namespace

Drupal\Tests\Core\Database

Code

public function provideQueriesToTrim() {
    return [
        '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.