function SchemaTestCase::tryInsert

1 call to SchemaTestCase::tryInsert()
SchemaTestCase::testSchema in drupal/modules/simpletest/tests/schema.test

File

drupal/modules/simpletest/tests/schema.test, line 140
Tests for the Database Schema API.

Class

SchemaTestCase
Unit tests for the Schema API.

Code

function tryInsert($table = 'test_table') {
  try {
    db_insert($table)
      ->fields(array(
      'id' => mt_rand(10, 20),
    ))
      ->execute();
    return TRUE;
  } catch (Exception $e) {
    return FALSE;
  }
}