You are here

function SelectTest::testIsNullCondition 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::testIsNullCondition()

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

File

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

Class

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