File tree Expand file tree Collapse file tree 2 files changed +24
-4
lines changed
tests/AntiMattr/Tests/MongoDB/Migrations/Tools/Console/Command Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Original file line number Diff line number Diff line change 16
16
"php" : " ^7.1" ,
17
17
"ext-mongodb" : " *" ,
18
18
"mongodb/mongodb" : " ^1.4" ,
19
- "symfony/console" : " ^3.4|^4" ,
20
- "symfony/yaml" : " ^3.4|^4"
19
+ "symfony/console" : " ^2.7|^ 3.4|^4" ,
20
+ "symfony/yaml" : " ^2.7|^ 3.4|^4"
21
21
},
22
22
"require-dev" : {
23
23
"phpunit/phpunit" : " ^7.0" ,
Original file line number Diff line number Diff line change @@ -438,12 +438,19 @@ public function testExecuteWithShowingVersions()
438
438
->with ("\n <info>==</info> Available Migration Versions \n" )
439
439
;
440
440
441
- $ this ->output ->expects ($ this ->at (40 ))
441
+ // Symfony 4.2 has different output
442
+ $ consoleVersion = $ this ->getSymfonyConsoleVersion ();
443
+ $ index = 39 ;
444
+ if (version_compare ($ consoleVersion , '4.2.0 ' , 'ge ' )) {
445
+ $ index = 40 ;
446
+ }
447
+
448
+ $ this ->output ->expects ($ this ->at ($ index ))
442
449
->method ('writeln ' )
443
450
->with ("\n <info>==</info> Previously Executed Unavailable Migration Versions \n" )
444
451
;
445
452
446
- $ this ->output ->expects ($ this ->at (41 ))
453
+ $ this ->output ->expects ($ this ->at (++ $ index ))
447
454
->method ('writeln ' )
448
455
->with (
449
456
sprintf (
@@ -460,6 +467,19 @@ public function testExecuteWithShowingVersions()
460
467
$ this ->output
461
468
);
462
469
}
470
+
471
+ /**
472
+ * @return mixed
473
+ */
474
+ private function getSymfonyConsoleVersion ()
475
+ {
476
+ $ versionData = [];
477
+ exec ('composer show | grep symfony/console ' , $ versionData );
478
+ $ versionPart = explode ('v ' , $ versionData [0 ]);
479
+ $ versionPart2 = explode (' ' , $ versionPart [1 ]);
480
+ $ consoleVersion = $ versionPart2 [0 ];
481
+ return $ consoleVersion ;
482
+ }
463
483
}
464
484
465
485
class StatusCommandStub extends StatusCommand
You can’t perform that action at this time.
0 commit comments