@@ -49,7 +49,7 @@ public function testRollbackCommandCallsMigratorWithProperArguments()
4949 $ migrator ->shouldReceive ('paths ' )->once ()->andReturn ([]);
5050 $ migrator ->shouldReceive ('setConnection ' )->once ()->with ('default ' );
5151 $ migrator ->shouldReceive ('setOutput ' )->once ()->andReturn ($ migrator );
52- $ migrator ->shouldReceive ('rollback ' )->once ()->with ([BASE_PATH . DIRECTORY_SEPARATOR . 'migrations ' ], ['pretend ' => false , 'step ' => 0 ]);
52+ $ migrator ->shouldReceive ('rollback ' )->once ()->with ([BASE_PATH . DIRECTORY_SEPARATOR . 'migrations ' ], ['pretend ' => false , 'step ' => 0 , ' batch ' => 0 ]);
5353
5454 $ this ->runCommand ($ command );
5555 }
@@ -60,11 +60,22 @@ public function testRollbackCommandCallsMigratorWithStepOption()
6060 $ migrator ->shouldReceive ('paths ' )->once ()->andReturn ([]);
6161 $ migrator ->shouldReceive ('setConnection ' )->once ()->with ('default ' );
6262 $ migrator ->shouldReceive ('setOutput ' )->once ()->andReturn ($ migrator );
63- $ migrator ->shouldReceive ('rollback ' )->once ()->with ([BASE_PATH . DIRECTORY_SEPARATOR . 'migrations ' ], ['pretend ' => false , 'step ' => 2 ]);
63+ $ migrator ->shouldReceive ('rollback ' )->once ()->with ([BASE_PATH . DIRECTORY_SEPARATOR . 'migrations ' ], ['pretend ' => false , 'step ' => 2 , ' batch ' => 0 ]);
6464
6565 $ this ->runCommand ($ command , ['--step ' => 2 ]);
6666 }
6767
68+ public function testRollbackCommandCallsMigratorWithBatchOption ()
69+ {
70+ $ command = new RollbackCommand ($ migrator = Mockery::mock (Migrator::class));
71+ $ migrator ->shouldReceive ('paths ' )->once ()->andReturn ([]);
72+ $ migrator ->shouldReceive ('setConnection ' )->once ()->with ('default ' );
73+ $ migrator ->shouldReceive ('setOutput ' )->once ()->andReturn ($ migrator );
74+ $ migrator ->shouldReceive ('rollback ' )->once ()->with ([BASE_PATH . DIRECTORY_SEPARATOR . 'migrations ' ], ['pretend ' => false , 'step ' => 0 , 'batch ' => 2 ]);
75+
76+ $ this ->runCommand ($ command , ['--batch ' => 2 ]);
77+ }
78+
6879 public function testRollbackCommandCanBePretended ()
6980 {
7081 $ command = new RollbackCommand ($ migrator = Mockery::mock (Migrator::class));
@@ -82,7 +93,7 @@ public function testRollbackCommandCanBePretendedWithStepOption()
8293 $ migrator ->shouldReceive ('paths ' )->once ()->andReturn ([]);
8394 $ migrator ->shouldReceive ('setConnection ' )->once ()->with ('foo ' );
8495 $ migrator ->shouldReceive ('setOutput ' )->once ()->andReturn ($ migrator );
85- $ migrator ->shouldReceive ('rollback ' )->once ()->with ([BASE_PATH . DIRECTORY_SEPARATOR . 'migrations ' ], ['pretend ' => true , 'step ' => 2 ]);
96+ $ migrator ->shouldReceive ('rollback ' )->once ()->with ([BASE_PATH . DIRECTORY_SEPARATOR . 'migrations ' ], ['pretend ' => true , 'step ' => 2 , ' batch ' => 0 ]);
8697
8798 $ this ->runCommand ($ command , ['--pretend ' => true , '--database ' => 'foo ' , '--step ' => 2 ]);
8899 }
0 commit comments