Skip to content

Commit f1b7578

Browse files
committed
Add tests for decimal scale fix
Signed-off-by: Matthew Peveler <matt.peveler@gmail.com>
1 parent 21cee19 commit f1b7578

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/Phinx/Db/Adapter/MysqlAdapterTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2727,6 +2727,21 @@ public function testCreateTableWithPrecisionCurrentTimestamp()
27272727
$this->assertEqualsIgnoringCase('CURRENT_TIMESTAMP(3)', $colDef['COLUMN_DEFAULT']);
27282728
}
27292729

2730+
public function testCreateTableWithZeroScale(): void
2731+
{
2732+
$this->adapter->connect();
2733+
$table = new Table('exampleCurrentTimestamp0', ['id' => false], $this->adapter);
2734+
$table
2735+
->addColumn('col_1', 'decimal', ['null' => false, 'precision' => 10, 'scale' => 0])
2736+
->create();
2737+
2738+
$columns = $table->getColumns();
2739+
$this->assertCount(1, $columns);
2740+
$this->assertSame('col_1', $columns[0]->getName());
2741+
$this->assertSame(10, $columns[0]->getPrecision());
2742+
$this->assertSame(0, $columns[0]->getScale());
2743+
}
2744+
27302745
public function pdoAttributeProvider()
27312746
{
27322747
return [

0 commit comments

Comments
 (0)