You are here

function DatabaseSelectTestCase::testNotNullCondition in SimpleTest 7

Test that we can find a record without a NULL value.

File

tests/database_test.test, line 1346

Class

DatabaseSelectTestCase
Test the SELECT builder.

Code

function testNotNullCondition() {
  $this
    ->ensureSampleDataNull();
  $names = db_select('test_null', 'tn')
    ->fields('tn', array(
    'name',
  ))
    ->isNotNull('tn.age')
    ->orderBy('name')
    ->execute()
    ->fetchCol();
  $this
    ->assertEqual(count($names), 2, t('Correct number of records found withNOT NULL age.'));
  $this
    ->assertEqual($names[0], 'Gonzo', t('Correct record returned for NOT NULL age.'));
  $this
    ->assertEqual($names[1], 'Kermit', t('Correct record returned for NOT NULL age.'));
}