1 database_test.test | DatabaseUpdateTestCase::testSimpleNullUpdate() |
Confirm updating to NULL.
File
- core/
modules/ simpletest/ tests/ database_test.test, line 756 - Database tests.
Class
- DatabaseUpdateTestCase
- Update builder tests.
Code
function testSimpleNullUpdate() {
$this->ensureSampleDataNull();
$num_updated = db_update('test_null')
->fields(array('age' => NULL))
->condition('name', 'Kermit')
->execute();
$this->assertIdentical($num_updated, 1, 'Updated 1 record.');
$saved_age = db_query('SELECT age FROM {test_null} WHERE name = :name', array(':name' => 'Kermit'))->fetchField();
$this->assertNull($saved_age, 'Updated name successfully.');
}