You are here

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

Tests string concatenation.

File

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

Class

BasicSyntaxTest
Tests SQL syntax interpretation.

Namespace

Drupal\system\Tests\Database

Code

function testConcatLiterals() {
  $result = db_query('SELECT CONCAT(:a1, CONCAT(:a2, CONCAT(:a3, CONCAT(:a4, :a5))))', array(
    ':a1' => 'This',
    ':a2' => ' ',
    ':a3' => 'is',
    ':a4' => ' a ',
    ':a5' => 'test.',
  ));
  $this
    ->assertIdentical($result
    ->fetchField(), 'This is a test.', 'Basic CONCAT works.');
}