function DatabaseUpdateTestCase::testMultiGTUpdate in SimpleTest 7
Confirm that we can update a multiple records with a non-equality condition.
File
- tests/
database_test.test, line 702
Class
- DatabaseUpdateTestCase
- Update builder tests.
Code
function testMultiGTUpdate() {
$num_updated = db_update('test')
->fields(array(
'job' => 'Musician',
))
->condition('age', 26, '>')
->execute();
$this
->assertIdentical($num_updated, 2, t('Updated 2 records.'));
$num_matches = db_query('SELECT COUNT(*) FROM {test} WHERE job = :job', array(
':job' => 'Musician',
))
->fetchField();
$this
->assertIdentical($num_matches, '2', t('Updated fields successfully.'));
}