function DatabaseBasicSyntaxTestCase::testFieldConcat

7.x database_test.test DatabaseBasicSyntaxTestCase::testFieldConcat()

Test for string concatenation with field values.

File

drupal-7.x/modules/simpletest/tests/database_test.test, line 3134

Class

DatabaseBasicSyntaxTestCase
Test how the current database driver interprets the SQL syntax.

Code

function testFieldConcat() {
  $result = db_query('SELECT CONCAT(:a1, CONCAT(name, CONCAT(:a2, CONCAT(age, :a3)))) FROM {test} WHERE age = :age', array(
    ':a1' => 'The age of ',
    ':a2' => ' is ',
    ':a3' => '.',
    ':age' => 25,
  ));
  $this->assertIdentical($result->fetchField(), 'The age of John is 25.', 'Field CONCAT works.');
}