You are here

function BasicSyntaxTest::testConcatWsFields 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::testConcatWsFields()

Tests string concatenation with separator, with field values.

File

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

Class

BasicSyntaxTest
Tests SQL syntax interpretation.

Namespace

Drupal\system\Tests\Database

Code

function testConcatWsFields() {
  $result = db_query("SELECT CONCAT_WS('-', :a1, name, :a2, age) FROM {test} WHERE age = :age", array(
    ':a1' => 'name',
    ':a2' => 'age',
    ':age' => 25,
  ));
  $this
    ->assertIdentical($result
    ->fetchField(), 'name-John-age-25');
}