You are here

function DatabaseInsertDefaultsTestCase::testDefaultInsert in SimpleTest 7

Test that we can run a query that is "default values for everything".

File

tests/database_test.test, line 614

Class

DatabaseInsertDefaultsTestCase
Insert tests for "database default" values.

Code

function testDefaultInsert() {
  $query = db_insert('test')
    ->useDefaults(array(
    'job',
  ));
  $id = $query
    ->execute();
  $schema = drupal_get_schema('test');
  $job = db_query('SELECT job FROM {test} WHERE id = :id', array(
    ':id' => $id,
  ))
    ->fetchField();
  $this
    ->assertEqual($job, $schema['fields']['job']['default'], t('Default field value is set.'));
}