You are here

public function ConnectionTest::provideQueriesToTrim in Drupal 8

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()

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,
      ],
    ],
  ];
}