You are here

function SchemaTestCase::tryInsert in Drupal 7

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

File

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