@@ -1319,9 +1319,41 @@ public function columnsProvider()
13191319 ['column15 ' , 'smallinteger ' , []],
13201320 ['column15 ' , 'integer ' , []],
13211321 ['column23 ' , 'json ' , []],
1322+ ['decimal_precision_scale ' , 'decimal ' , ['precision ' => 10 , 'scale ' => 2 ]],
1323+ ['decimal_precision_zero_scale ' , 'decimal ' , ['precision ' => 10 , 'scale ' => 0 ]],
13221324 ];
13231325 }
13241326
1327+ /**
1328+ * @dataProvider columnsProvider
1329+ */
1330+ public function testGetColumns ($ colName , $ type , $ options )
1331+ {
1332+ $ table = new Table ('t ' , [], $ this ->adapter );
1333+ $ table ->addColumn ($ colName , $ type , $ options )->save ();
1334+
1335+ $ columns = $ this ->adapter ->getColumns ('t ' );
1336+ $ this ->assertCount (2 , $ columns );
1337+ $ this ->assertEquals ($ colName , $ columns [1 ]->getName ());
1338+ $ this ->assertEquals ($ type , $ columns [1 ]->getType ());
1339+
1340+ if (isset ($ options ['limit ' ])) {
1341+ $ this ->assertEquals ($ options ['limit ' ], $ columns [1 ]->getLimit ());
1342+ }
1343+
1344+ if (isset ($ options ['precision ' ])) {
1345+ $ this ->assertEquals ($ options ['precision ' ], $ columns [1 ]->getPrecision ());
1346+ }
1347+
1348+ if (isset ($ options ['scale ' ])) {
1349+ $ this ->assertEquals ($ options ['scale ' ], $ columns [1 ]->getScale ());
1350+ }
1351+
1352+ if (isset ($ options ['comment ' ])) {
1353+ $ this ->assertEquals ($ options ['comment ' ], $ columns [1 ]->getComment ());
1354+ }
1355+ }
1356+
13251357 public function testAddIndex ()
13261358 {
13271359 $ table = new Table ('table1 ' , [], $ this ->adapter );
@@ -3166,7 +3198,7 @@ public function provideColumnNamesToCheck()
31663198 * @covers \Phinx\Db\Adapter\SQLiteAdapter::getTableInfo
31673199 * @covers \Phinx\Db\Adapter\SQLiteAdapter::getColumns
31683200 */
3169- public function testGetColumns ()
3201+ public function testGetMultipleColumns ()
31703202 {
31713203 $ conn = $ this ->adapter ->getConnection ();
31723204 $ conn ->exec ('create table t(a integer, b text, c char(5), d integer(12,6), e integer not null, f integer null) ' );
0 commit comments