You are here

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

Test numeric field precision.

File

src/Tests/SqlServerSchemaTest.php, line 297
Definition of Drupal\sqlsrv\Tests\SqlServerSchemaTest.

Class

SqlServerSchemaTest
Schema tests for SQL Server database driver.

Namespace

Drupal\sqlsrv\Tests

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.'));
}