function BasicSyntaxTest::testConcatWsFields
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Database/BasicSyntaxTest.php \Drupal\KernelTests\Core\Database\BasicSyntaxTest::testConcatWsFields()
- 10 core/tests/Drupal/KernelTests/Core/Database/BasicSyntaxTest.php \Drupal\KernelTests\Core\Database\BasicSyntaxTest::testConcatWsFields()
- 11.x core/tests/Drupal/KernelTests/Core/Database/BasicSyntaxTest.php \Drupal\KernelTests\Core\Database\BasicSyntaxTest::testConcatWsFields()
Tests string concatenation with separator, with field values.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Database/ BasicSyntaxTest.php, line 66
Class
- BasicSyntaxTest
- Tests SQL syntax interpretation.
Namespace
Drupal\KernelTests\Core\DatabaseCode
public function testConcatWsFields() {
$result = $this->connection
->query("SELECT CONCAT_WS('-', :a1, name, :a2, age) FROM {test} WHERE age = :age", [
':a1' => 'name',
':a2' => 'age',
':age' => 25,
]);
$this->assertIdentical($result->fetchField(), 'name-John-age-25');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.