@@ -3037,6 +3037,51 @@ public function testAlgorithmWithMixedCase()
30373037 $ this ->assertTrue ($ this ->adapter ->hasColumn ('mixed_case ' , 'col2 ' ));
30383038 }
30393039
3040+ public function testAddColumnWithAlgorithmAndLockSqlContainsClause ()
3041+ {
3042+ $ table = new Table ('col_sql_verify ' , [], $ this ->adapter );
3043+ $ table ->addColumn ('col1 ' , 'string ' )
3044+ ->create ();
3045+
3046+ $ this ->io ->level (ConsoleIo::VERBOSE );
3047+ $ this ->out ->clear ();
3048+
3049+ $ table ->addColumn ('col2 ' , 'string ' , [
3050+ 'null ' => true ,
3051+ 'algorithm ' => MysqlAdapter::ALGORITHM_INPLACE ,
3052+ 'lock ' => MysqlAdapter::LOCK_NONE ,
3053+ ])->update ();
3054+
3055+ $ output = $ this ->out ->output ();
3056+ $ this ->assertStringContainsString ('ALGORITHM=INPLACE ' , $ output );
3057+ $ this ->assertStringContainsString ('LOCK=NONE ' , $ output );
3058+ $ this ->assertTrue ($ this ->adapter ->hasColumn ('col_sql_verify ' , 'col2 ' ));
3059+ }
3060+
3061+ public function testAddColumnWithFluentColumnBuilder ()
3062+ {
3063+ $ table = new Table ('col_fluent ' , [], $ this ->adapter );
3064+ $ table ->addColumn ('col1 ' , 'string ' )
3065+ ->create ();
3066+
3067+ $ column = new Column ();
3068+ $ column ->setName ('col2 ' )
3069+ ->setType ('string ' )
3070+ ->setNull (true )
3071+ ->setAlgorithm (MysqlAdapter::ALGORITHM_INPLACE )
3072+ ->setLock (MysqlAdapter::LOCK_NONE );
3073+
3074+ $ this ->io ->level (ConsoleIo::VERBOSE );
3075+ $ this ->out ->clear ();
3076+
3077+ $ table ->addColumn ($ column )->update ();
3078+
3079+ $ output = $ this ->out ->output ();
3080+ $ this ->assertStringContainsString ('ALGORITHM=INPLACE ' , $ output );
3081+ $ this ->assertStringContainsString ('LOCK=NONE ' , $ output );
3082+ $ this ->assertTrue ($ this ->adapter ->hasColumn ('col_fluent ' , 'col2 ' ));
3083+ }
3084+
30403085 public function testAddIndexWithAlgorithm ()
30413086 {
30423087 $ table = new Table ('index_algo ' , [], $ this ->adapter );
@@ -3226,6 +3271,48 @@ public function testAddFulltextIndexWithInstantAndLockThrowsException()
32263271 ])->update ();
32273272 }
32283273
3274+ public function testAddIndexWithAlgorithmAndLockSqlContainsClause ()
3275+ {
3276+ $ table = new Table ('idx_sql_verify ' , [], $ this ->adapter );
3277+ $ table ->addColumn ('email ' , 'string ' )
3278+ ->create ();
3279+
3280+ $ this ->io ->level (ConsoleIo::VERBOSE );
3281+ $ this ->out ->clear ();
3282+
3283+ $ table ->addIndex ('email ' , [
3284+ 'algorithm ' => MysqlAdapter::ALGORITHM_INPLACE ,
3285+ 'lock ' => MysqlAdapter::LOCK_NONE ,
3286+ ])->update ();
3287+
3288+ $ output = $ this ->out ->output ();
3289+ $ this ->assertStringContainsString ('ALGORITHM=INPLACE ' , $ output );
3290+ $ this ->assertStringContainsString ('LOCK=NONE ' , $ output );
3291+ $ this ->assertTrue ($ this ->adapter ->hasIndex ('idx_sql_verify ' , ['email ' ]));
3292+ }
3293+
3294+ public function testAddIndexWithFluentIndexBuilder ()
3295+ {
3296+ $ table = new Table ('idx_fluent ' , [], $ this ->adapter );
3297+ $ table ->addColumn ('email ' , 'string ' )
3298+ ->create ();
3299+
3300+ $ index = new Index ();
3301+ $ index ->setColumns ('email ' )
3302+ ->setAlgorithm (MysqlAdapter::ALGORITHM_INPLACE )
3303+ ->setLock (MysqlAdapter::LOCK_NONE );
3304+
3305+ $ this ->io ->level (ConsoleIo::VERBOSE );
3306+ $ this ->out ->clear ();
3307+
3308+ $ table ->addIndex ($ index )->update ();
3309+
3310+ $ output = $ this ->out ->output ();
3311+ $ this ->assertStringContainsString ('ALGORITHM=INPLACE ' , $ output );
3312+ $ this ->assertStringContainsString ('LOCK=NONE ' , $ output );
3313+ $ this ->assertTrue ($ this ->adapter ->hasIndex ('idx_fluent ' , ['email ' ]));
3314+ }
3315+
32293316 public function testInsertOrUpdateWithDuplicates ()
32303317 {
32313318 $ table = new Table ('currencies ' , [], $ this ->adapter );
0 commit comments