function BasicSyntaxTest::testConcatWsLiterals

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Database/BasicSyntaxTest.php \Drupal\KernelTests\Core\Database\BasicSyntaxTest::testConcatWsLiterals()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Database/BasicSyntaxTest.php \Drupal\KernelTests\Core\Database\BasicSyntaxTest::testConcatWsLiterals()
  3. 11.x 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 55

Class

BasicSyntaxTest
Tests SQL syntax interpretation.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testConcatWsLiterals() : void {
    $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());
}

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