function DatabaseQueryTestCase::testArraySubstitution

7.x database_test.test DatabaseQueryTestCase::testArraySubstitution()

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

File

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

Class

DatabaseQueryTestCase
Drupal-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');
}