You are here

public function ConnectionTest::provideQueriesToTrim in Drupal 9

Same name and namespace in other branches
  1. 8 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()

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 696

Class

ConnectionTest
Tests the Connection class.

Namespace

Drupal\Tests\Core\Database

Code

public function provideQueriesToTrim() {
  return [
    'remove_non_breaking_space' => [
      'SELECT * FROM test',
      "",
      [],
    ],
    '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,
      ],
    ],
  ];
}