You are here

public function BasicSyntaxTest::testConcatWsLiterals in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Database/BasicSyntaxTest.php \Drupal\KernelTests\Core\Database\BasicSyntaxTest::testConcatWsLiterals()

Tests string concatenation with separator.

File

core/tests/Drupal/KernelTests/Core/Database/BasicSyntaxTest.php, line 53

Class

BasicSyntaxTest
Tests SQL syntax interpretation.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testConcatWsLiterals() {
  $result = $this->connection
    ->query("SELECT CONCAT_WS(', ', :a1, NULL, :a2, :a3, :a4)", [
    ':a1' => 'Hello',
    ':a2' => NULL,
    ':a3' => '',
    ':a4' => 'world.',
  ]);
  $this
    ->assertSame('Hello, , world.', $result
    ->fetchField());
}