You are here

public function SqlServerSchemaTest::testNumericFieldPrecision in Drupal driver for SQL Server and SQL Azure 7.2

Same name and namespace in other branches
  1. 7.3 tests/sqlsrv.schema.test \SqlServerSchemaTest::testNumericFieldPrecision()

Test numeric field precision.

File

tests/sqlsrv.schema.test, line 293
Support tests for SQL Server.

Class

SqlServerSchemaTest
@file Support tests for SQL Server.

Code

public function testNumericFieldPrecision() {
  $table_spec = array(
    'fields' => array(
      'id' => array(
        'type' => 'serial',
        'not null' => TRUE,
      ),
      'name' => array(
        'type' => 'numeric',
        'precision' => 400,
        'scale' => 2,
      ),
    ),
    'primary key' => array(
      'id',
    ),
  );
  $success = FALSE;
  try {
    db_create_table('test_table_binary', $table_spec);
    $success = TRUE;
  } catch (Exception $error) {
    $success = FALSE;
  }
  $this
    ->assertTrue($success, t('Able to create a numeric field with an out of bounds precision.'));
}