public function ConnectionTest::testQueryTrim in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Core/Database/ConnectionTest.php \Drupal\Tests\Core\Database\ConnectionTest::testQueryTrim()
- 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 306
Class
- ConnectionTest
- Tests the Connection class.
Namespace
Drupal\Tests\Core\DatabaseCode
public function testQueryTrim($expected, $query, $options) {
$mock_pdo = $this
->getMockBuilder(StubPdo::class)
->setMethods([
'execute',
'prepare',
'setAttribute',
])
->getMock();
// Ensure that PDO::prepare() is called only once, and with the
// correctly trimmed query string.
$mock_pdo
->expects($this
->once())
->method('prepare')
->with($expected)
->willReturnSelf();
$connection = new StubConnection($mock_pdo, []);
$connection
->query($query, [], $options);
}