You are here

function SelectTest::testNullCondition in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Database/SelectTest.php \Drupal\system\Tests\Database\SelectTest::testNullCondition()

Tests that a comparison with NULL is always FALSE.

File

core/modules/system/src/Tests/Database/SelectTest.php, line 215
Contains \Drupal\system\Tests\Database\SelectTest.

Class

SelectTest
Tests the Select query 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.');
}