1 database_test.test DatabaseQueryTestCase::testArraySubstitution()

Test that we can specify an array of values in the query by passing in an array.

File

core/modules/simpletest/tests/database_test.test, line 3231
Database tests.

Class

DatabaseQueryTestCase
Backdrop-specific SQL syntax tests.

Code

function testArraySubstitution() {
  $names = db_query('SELECT name FROM {test} WHERE age IN (:ages) ORDER BY age', array(':ages' => array(25, 26, 27)))->fetchAll();

  $this->assertEqual(count($names), 3, 'Correct number of names returned');
}