function DatabaseTestCase::ensureSampleDataNull

7.x database_test.test DatabaseTestCase::ensureSampleDataNull()

Set up tables for NULL handling.

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

File

drupal-7.x/modules/simpletest/tests/database_test.test, line 59

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();
}