function DatabaseUpdateComplexTestCase::testLikeConditionUpdate in SimpleTest 7
Test LIKE conditionals.
File
- tests/
database_test.test, line 821
Class
- DatabaseUpdateComplexTestCase
- Tests for more complex update statements.
Code
function testLikeConditionUpdate() {
$num_updated = db_update('test')
->fields(array(
'job' => 'Musician',
))
->condition('name', '%ge%', 'LIKE')
->execute();
$this
->assertIdentical($num_updated, 1, t('Updated 1 record.'));
$num_matches = db_query('SELECT COUNT(*) FROM {test} WHERE job = :job', array(
':job' => 'Musician',
))
->fetchField();
$this
->assertIdentical($num_matches, '1', t('Updated fields successfully.'));
}