1 database_test.test DatabaseSelectTestCase::testNullCondition()

Test that a comparison with NULL is always FALSE.

File

core/modules/simpletest/tests/database_test.test, line 1511
Database tests.

Class

DatabaseSelectTestCase
Test the SELECT builder.

Code

function testNullCondition() {
  $this->ensureSampleDataNull();

  $names = db_select('test_null', 'tn')
    ->fields('tn', array('name'))
    ->condition('age', NULL)
    ->execute()->fetchCol();

  $this->assertEqual(count($names), 0, t('No records found when comparing to NULL.'));
}