function DatabaseUpdateComplexTestCase::testBetweenConditionUpdate in Drupal 7
Test BETWEEN conditional clauses.
File
- modules/
simpletest/ tests/ database_test.test, line 958
Class
- DatabaseUpdateComplexTestCase
- Tests for more complex update statements.
Code
function testBetweenConditionUpdate() {
$num_updated = db_update('test')
->fields(array(
'job' => 'Musician',
))
->condition('age', array(
25,
26,
), 'BETWEEN')
->execute();
$this
->assertIdentical($num_updated, 2, 'Updated 2 records.');
$num_matches = db_query('SELECT COUNT(*) FROM {test} WHERE job = :job', array(
':job' => 'Musician',
))
->fetchField();
$this
->assertIdentical($num_matches, '2', 'Updated fields successfully.');
}