Skip to content

Commit 0465ed3

Browse files
authored
Fix #298: Add test for negative default values and parentheses (#299)
1 parent 5b9fa83 commit 0465ed3

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

tests/ColumnSchemaTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,4 +173,19 @@ public function testBoolDefault(): void
173173

174174
$db->close();
175175
}
176+
177+
public function testNegativeDefaultValues()
178+
{
179+
$db = $this->getConnection(true);
180+
181+
$schema = $db->getSchema();
182+
$tableSchema = $schema->getTableSchema('negative_default_values');
183+
184+
$this->assertSame(-123, $tableSchema->getColumn('tinyint_col')->getDefaultValue());
185+
$this->assertSame(-123, $tableSchema->getColumn('smallint_col')->getDefaultValue());
186+
$this->assertSame(-123, $tableSchema->getColumn('int_col')->getDefaultValue());
187+
$this->assertSame(-123, $tableSchema->getColumn('bigint_col')->getDefaultValue());
188+
$this->assertSame(-12345.6789, $tableSchema->getColumn('float_col')->getDefaultValue());
189+
$this->assertSame(-33.22, $tableSchema->getColumn('numeric_col')->getDefaultValue());
190+
}
176191
}

0 commit comments

Comments
 (0)