function ConnectionTest::testQueryTrim

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Database/ConnectionTest.php \Drupal\Tests\Core\Database\ConnectionTest::testQueryTrim()
  2. 8.9.x core/tests/Drupal/Tests/Core/Database/ConnectionTest.php \Drupal\Tests\Core\Database\ConnectionTest::testQueryTrim()
  3. 10 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 613

Class

ConnectionTest
Tests the Connection class.

Namespace

Drupal\Tests\Core\Database

Code

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

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