function DatabaseQueryTestCase::testArraySubstitution in SimpleTest 7
Test that we can specify an array of values in the query by simply passing in an array.
File
- tests/
database_test.test, line 2664
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, t('Correct number of names returned'));
}