You are here

public function ConnectionTest::testQueryTrim in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Database/ConnectionTest.php \Drupal\Tests\Core\Database\ConnectionTest::testQueryTrim()
  2. 9 core/tests/Drupal/Tests/Core/Database/ConnectionTest.php \Drupal\Tests\Core\Database\ConnectionTest::testQueryTrim()

Test rtrim() of query strings.

@dataProvider provideQueriesToTrim

File

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

Class

ConnectionTest
Tests the Connection class.

Namespace

Drupal\Tests\Core\Database

Code

public function testQueryTrim($expected, $query, $options) {
  $mock_pdo = $this
    ->getMockBuilder(StubPdo::class)
    ->getMock();
  $connection = new StubConnection($mock_pdo, []);
  $preprocess_method = new \ReflectionMethod($connection, 'preprocessStatement');
  $preprocess_method
    ->setAccessible(TRUE);
  $this
    ->assertSame($expected, $preprocess_method
    ->invoke($connection, $query, $options));
}