function DatabaseSelectTestCase::testNullCondition
Test that we can find a record with a NULL value.
File
-
modules/
simpletest/ tests/ database_test.test, line 1643
Class
- DatabaseSelectTestCase
- Test the SELECT builder.
Code
function testNullCondition() {
$this->ensureSampleDataNull();
$names = db_select('test_null', 'tn')->fields('tn', array(
'name',
))
->isNull('age')
->execute()
->fetchCol();
$this->assertEqual(count($names), 1, 'Correct number of records found with NULL age.');
$this->assertEqual($names[0], 'Fozzie', 'Correct record returned for NULL age.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.