function DatabaseTestCase::ensureSampleDataNull

Set up tables for NULL handling.

3 calls to DatabaseTestCase::ensureSampleDataNull()
DatabaseSelectTestCase::testNotNullCondition in modules/simpletest/tests/database_test.test
Test that we can find a record without a NULL value.
DatabaseSelectTestCase::testNullCondition in modules/simpletest/tests/database_test.test
Test that we can find a record with a NULL value.
DatabaseUpdateTestCase::testSimpleNullUpdate in modules/simpletest/tests/database_test.test
Confirm updating to NULL.

File

modules/simpletest/tests/database_test.test, line 62

Class

DatabaseTestCase
Base test class for databases.

Code

function ensureSampleDataNull() {
    $schema['test_null'] = drupal_get_schema('test_null');
    $this->installTables($schema);
    db_insert('test_null')->fields(array(
        'name',
        'age',
    ))
        ->values(array(
        'name' => 'Kermit',
        'age' => 25,
    ))
        ->values(array(
        'name' => 'Fozzie',
        'age' => NULL,
    ))
        ->values(array(
        'name' => 'Gonzo',
        'age' => 27,
    ))
        ->execute();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.