protected function SqlServerSchemaTest::assertSignedField in Drupal driver for SQL Server and SQL Azure 7.3
Same name and namespace in other branches
- 7 tests/sqlsrv.schema.test \SqlServerSchemaTest::assertSignedField()
- 7.2 tests/sqlsrv.schema.test \SqlServerSchemaTest::assertSignedField()
Test inserting data in signed field.
1 call to SqlServerSchemaTest::assertSignedField()
- SqlServerSchemaTest::testUnsignedField in tests/
sqlsrv.schema.test - Test adding / modifying an unsigned column.
File
- tests/
sqlsrv.schema.test, line 167 - Support tests for SQL Server.
Class
- SqlServerSchemaTest
- @file Support tests for SQL Server.
Code
protected function assertSignedField($table, $field_name) {
try {
db_insert('test_table')
->fields(array(
'id' => -1,
))
->execute();
$success = TRUE;
} catch (Exception $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 (Exception $e) {
$success = FALSE;
}
$this
->assertTrue($success, t('Inserting a positive value in a signed field succeeded.'));
db_delete('test_table')
->execute();
}