SchemaTestCase::tryInsert

  1. drupal
    1. 8
    2. 7
Versions
7 SchemaTestCase::tryInsert($table = 'test_table')

Code

modules/simpletest/tests/schema.test, line 140

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