function SelectTest::testIsNullCondition

Tests that we can find a record with a NULL value.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Database/SelectTest.php, line 207
Definition of Drupal\system\Tests\Database\SelectTest.

Class

SelectTest
Tests the SELECT builder.

Namespace

Drupal\system\Tests\Database

Code

function testIsNullCondition() {
  $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.');
}