You are here

function DatabaseAnsiSyntaxTestCase::testFieldConcat in SimpleTest 7

Test for ANSI string concatenation with field values.

File

tests/database_test.test, line 2561

Class

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

Code

function testFieldConcat() {
  $result = db_query('SELECT :a1 || name || :a2 || 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.', t('Field ANSI Concat works.'));
}