function SelectTest::testNullCondition

Tests that a comparison with NULL is always FALSE.

File

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

Class

SelectTest
Tests the SELECT builder.

Namespace

Drupal\system\Tests\Database

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, 'No records found when comparing to NULL.');
}