@@ -26,10 +26,24 @@ protected function setUp()
2626 {
2727 $ this ->command = new StatusCommandStub ();
2828 $ this ->output = $ this ->buildMock ('Symfony\Component\Console\Output\OutputInterface ' );
29+ $ this ->outputFormatter = $ this ->buildMock (
30+ 'Symfony\Component\Console\Formatter\OutputFormatterInterface '
31+ );
32+ $ this ->output
33+ ->method ('getFormatter ' )
34+ ->will ($ this ->returnValue ($ this ->outputFormatter ));
35+
2936 $ this ->config = $ this ->buildMock ('AntiMattr\MongoDB\Migrations\Configuration\Configuration ' );
30- $ this ->migration = $ this ->buildMock ('AntiMattr\MongoDB\Migrations\Migration ' );
37+ $ this ->migration = $ this ->buildMock ('AntiMattr\MongoDB\Migrations\AbstractMigration ' );
3138 $ this ->version = $ this ->buildMock ('AntiMattr\MongoDB\Migrations\Version ' );
39+ $ this ->version ->expects ($ this ->any ())
40+ ->method ('getMigration ' )
41+ ->will ($ this ->returnValue ($ this ->migration ));
42+
3243 $ this ->version2 = $ this ->buildMock ('AntiMattr\MongoDB\Migrations\Version ' );
44+ $ this ->version2 ->expects ($ this ->any ())
45+ ->method ('getMigration ' )
46+ ->will ($ this ->returnValue ($ this ->migration ));
3347
3448 $ this ->command ->setMigrationConfiguration ($ this ->config );
3549 }
@@ -239,17 +253,22 @@ public function testExecuteWithShowingVersions()
239253 $ numNewMigrations = 1 ;
240254 $ notMigratedVersion = '20140822185743 ' ;
241255 $ migratedVersion = '20140822185745 ' ;
256+ $ migrationDescription = 'drop all collections ' ;
242257 $ unavailableMigratedVersion = '20140822185744 ' ;
243258
244259 // Expectations
245- $ this ->version ->expects ($ this ->exactly (3 ))
260+ $ this ->version ->expects ($ this ->exactly (2 ))
246261 ->method ('getVersion ' )
247262 ->will ($ this ->returnValue ($ notMigratedVersion ));
248263
249264 $ this ->version2 ->expects ($ this ->exactly (3 ))
250265 ->method ('getVersion ' )
251266 ->will ($ this ->returnValue ($ migratedVersion ));
252267
268+ $ this ->migration
269+ ->method ('getDescription ' )
270+ ->will ($ this ->returnValue ('drop all ' ));
271+
253272 $ this ->config ->expects ($ this ->once ())
254273 ->method ('getDetailsMap ' )
255274 ->will (
@@ -287,15 +306,6 @@ public function testExecuteWithShowingVersions()
287306 )
288307 )
289308 ;
290- $ this ->config ->expects ($ this ->once ())
291- ->method ('getUnavailableMigratedVersions ' )
292- ->will (
293- $ this ->returnValue (
294- array ($ unavailableMigratedVersion )
295- )
296- )
297- ;
298-
299309 $ this ->output ->expects ($ this ->at (0 ))
300310 ->method ('writeln ' )
301311 ->with (
@@ -422,40 +432,6 @@ public function testExecuteWithShowingVersions()
422432 ->method ('writeln ' )
423433 ->with ("\n <info>==</info> Available Migration Versions \n" )
424434 ;
425- $ this ->output ->expects ($ this ->at (15 ))
426- ->method ('writeln ' )
427- ->with (
428- sprintf (
429- ' <comment>>></comment> %s (<comment>%s</comment>) <error>not migrated</error> ' ,
430- \DateTime::createFromFormat ('YmdHis ' , $ notMigratedVersion )->format ('Y-m-d H:i:s ' ),
431- $ notMigratedVersion
432- )
433- )
434- ;
435- $ this ->output ->expects ($ this ->at (16 ))
436- ->method ('writeln ' )
437- ->with (
438- sprintf (
439- ' <comment>>></comment> %s (<comment>%s</comment>) <info>migrated</info> ' ,
440- \DateTime::createFromFormat ('YmdHis ' , $ migratedVersion )->format ('Y-m-d H:i:s ' ),
441- $ migratedVersion
442- )
443- )
444- ;
445- $ this ->output ->expects ($ this ->at (17 ))
446- ->method ('writeln ' )
447- ->with ("\n <info>==</info> Previously Executed Unavailable Migration Versions \n" )
448- ;
449- $ this ->output ->expects ($ this ->at (18 ))
450- ->method ('writeln ' )
451- ->with (
452- sprintf (
453- ' <comment>>></comment> %s (<comment>%s</comment>) ' ,
454- \DateTime::createFromFormat ('YmdHis ' , $ unavailableMigratedVersion )->format ('Y-m-d H:i:s ' ),
455- $ unavailableMigratedVersion
456- )
457- )
458- ;
459435
460436 // Run command, run.
461437 $ this ->command ->run (
0 commit comments