You are here

protected function SqlServerSchemaTest::assertSignedField in Drupal driver for SQL Server and SQL Azure 8

1 call to SqlServerSchemaTest::assertSignedField()
SqlServerSchemaTest::testUnsignedField in src/Tests/SqlServerSchemaTest.php
Test adding / modifying an unsigned column.

File

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

Class

SqlServerSchemaTest
Schema tests for SQL Server database driver.

Namespace

Drupal\sqlsrv\Tests

Code

protected function assertSignedField($table, $field_name) {
  try {
    db_insert('test_table')
      ->fields(array(
      'id' => -1,
    ))
      ->execute();
    $success = TRUE;
  } catch (DatabaseException $e) {
    $success = FALSE;
  }
  $this
    ->assertTrue($success, t('Inserting a negative value in a signed field succeeded.'));
  try {
    db_insert('test_table')
      ->fields(array(
      'id' => 1,
    ))
      ->execute();
    $success = TRUE;
  } catch (DatabaseException $e) {
    $success = FALSE;
  }
  $this
    ->assertTrue($success, t('Inserting a positive value in a signed field succeeded.'));
  db_delete('test_table')
    ->execute();
}