You are here

function BasicSyntaxTest::testConcatWsLiterals in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Database/BasicSyntaxTest.php \Drupal\system\Tests\Database\BasicSyntaxTest::testConcatWsLiterals()

Tests string concatenation with separator.

File

core/modules/system/src/Tests/Database/BasicSyntaxTest.php, line 50
Contains \Drupal\system\Tests\Database\BasicSyntaxTest.

Class

BasicSyntaxTest
Tests SQL syntax interpretation.

Namespace

Drupal\system\Tests\Database

Code

function testConcatWsLiterals() {
  $result = db_query("SELECT CONCAT_WS(', ', :a1, NULL, :a2, :a3, :a4)", array(
    ':a1' => 'Hello',
    ':a2' => NULL,
    ':a3' => '',
    ':a4' => 'world.',
  ));
  $this
    ->assertIdentical($result
    ->fetchField(), 'Hello, , world.');
}