@@ -272,23 +272,24 @@ public function testCreateTableWithAutoIncrement()
272272 'description ' => Schema::TYPE_STRING ,
273273 ];
274274 $ this ->getConnection (false )->createCommand ($ qb ->createTable ('autoincrement_table ' , $ columns ))->execute ();
275+ $ qb ->db ->getTableSchema ('autoincrement_table ' , true ); //Force update schema
276+
277+ $ this ->assertEquals (1 , $ this ->getConnection (false )->getSchema ()->insert ('autoincrement_table ' , ['description ' => 'auto increment 1 ' ])['id ' ]);
278+ $ this ->assertEquals (2 , $ this ->getConnection (false )->getSchema ()->insert ('autoincrement_table ' , ['description ' => 'auto increment 2 ' ])['id ' ]);
279+ $ this ->assertEquals (3 , $ this ->getConnection (false )->getSchema ()->insert ('autoincrement_table ' , ['description ' => 'auto increment 3 ' ])['id ' ]);
280+ $ this ->assertEquals (4 , $ this ->getConnection (false )->getSchema ()->insert ('autoincrement_table ' , ['description ' => 'auto increment 4 ' ])['id ' ]);
275281
276- $ this ->getConnection (false )->createCommand ()->insert ('autoincrement_table ' , ['description ' => 'auto increment 1 ' ])->execute ();
277- $ this ->getConnection (false )->createCommand ()->insert ('autoincrement_table ' , ['description ' => 'auto increment 2 ' ])->execute ();
278- $ this ->getConnection (false )->createCommand ()->insert ('autoincrement_table ' , ['description ' => 'auto increment 3 ' ])->execute ();
279- $ this ->getConnection (false )->createCommand ()->insert ('autoincrement_table ' , ['description ' => 'auto increment 4 ' ])->execute ();
280-
281282 $ this ->assertEquals (4 , (new Query ())->from ('autoincrement_table ' )->max ('id ' , $ this ->getConnection (false )));
282283
283284 //Drop and recreate, for test sequences
284285 $ this ->getConnection (false )->createCommand ($ qb ->dropTable ('autoincrement_table ' ))->execute ();
285286 $ this ->getConnection (false )->createCommand ($ qb ->createTable ('autoincrement_table ' , $ columns ))->execute ();
286287
287- $ this ->getConnection (false )->createCommand ()->insert ('autoincrement_table ' , ['description ' => 'auto increment 1 ' ])-> execute ( );
288- $ this ->getConnection (false )->createCommand ()->insert ('autoincrement_table ' , ['description ' => 'auto increment 2 ' ])-> execute ( );
289- $ this ->getConnection (false )->createCommand ()->insert ('autoincrement_table ' , ['description ' => 'auto increment 3 ' ])-> execute ( );
290- $ this ->getConnection (false )->createCommand ()->insert ('autoincrement_table ' , ['description ' => 'auto increment 4 ' ])-> execute ( );
291-
288+ $ this ->assertEquals ( 1 , $ this -> getConnection (false )->getSchema ()->insert ('autoincrement_table ' , ['description ' => 'auto increment 1 ' ])[ ' id ' ] );
289+ $ this ->assertEquals ( 2 , $ this -> getConnection (false )->getSchema ()->insert ('autoincrement_table ' , ['description ' => 'auto increment 2 ' ])[ ' id ' ] );
290+ $ this ->assertEquals ( 3 , $ this -> getConnection (false )->getSchema ()->insert ('autoincrement_table ' , ['description ' => 'auto increment 3 ' ])[ ' id ' ] );
291+ $ this ->assertEquals ( 4 , $ this -> getConnection (false )->getSchema ()->insert ('autoincrement_table ' , ['description ' => 'auto increment 4 ' ])[ ' id ' ] );
292+
292293 $ this ->assertEquals (4 , (new Query ())->from ('autoincrement_table ' )->max ('id ' , $ this ->getConnection (false )));
293294 }
294295}
0 commit comments