public function QueryTest::testNumericExpressionSubstitution in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/Database/QueryTest.php \Drupal\KernelTests\Core\Database\QueryTest::testNumericExpressionSubstitution()
Tests numeric query parameter expansion in expressions.
See also
\Drupal\Core\Database\Driver\sqlite\Statement::getStatement()
http://bugs.php.net/bug.php?id=45259
File
- core/
tests/ Drupal/ KernelTests/ Core/ Database/ QueryTest.php, line 144
Class
- QueryTest
- Tests Drupal's extended prepared statement syntax..
Namespace
Drupal\KernelTests\Core\DatabaseCode
public function testNumericExpressionSubstitution() {
$count_expected = $this->connection
->query('SELECT COUNT(*) + 3 FROM {test}')
->fetchField();
$count = $this->connection
->query('SELECT COUNT(*) + :count FROM {test}', [
':count' => 3,
])
->fetchField();
$this
->assertEquals($count_expected, $count);
}