44
55use Doctrine \Bundle \MigrationsBundle \Command \DoctrineCommand ;
66use Doctrine \DBAL \Migrations \Configuration \Configuration ;
7+ use ReflectionClass ;
78use Symfony \Component \DependencyInjection \ContainerBuilder ;
89use Symfony \Component \DependencyInjection \ParameterBag \ParameterBag ;
910
@@ -18,17 +19,41 @@ public function testConfigureMigrations()
1819 $ configurationMock ->method ('getMigrations ' )
1920 ->willReturn (array ());
2021
22+ $ reflectionClass = new ReflectionClass ('Doctrine\DBAL\Migrations\Configuration\Configuration ' );
23+ if ($ reflectionClass ->hasMethod ('getCustomTemplate ' )) {
24+ $ configurationMock
25+ ->expects ($ this ->once ())
26+ ->method ('setCustomTemplate ' )
27+ ->with ('migrations.tpl ' );
28+ }
29+
30+ $ configurationMock
31+ ->expects ($ this ->once ())
32+ ->method ('setMigrationsTableName ' )
33+ ->with ('migrations ' );
34+
35+ $ configurationMock
36+ ->expects ($ this ->once ())
37+ ->method ('setMigrationsNamespace ' )
38+ ->with ('App\Migrations ' );
39+
40+ $ configurationMock
41+ ->expects ($ this ->once ())
42+ ->method ('setMigrationsDirectory ' )
43+ ->with (__DIR__ . '/../../ ' );
44+
2145 DoctrineCommand::configureMigrations ($ this ->getContainer (), $ configurationMock );
2246 }
2347
2448 private function getContainer ()
2549 {
2650 return new ContainerBuilder (new ParameterBag (array (
27- 'doctrine_migrations.dir_name ' => __DIR__ . '/../../ ' ,
28- 'doctrine_migrations.namespace ' => 'test ' ,
29- 'doctrine_migrations.name ' => 'test ' ,
30- 'doctrine_migrations.table_name ' => 'test ' ,
51+ 'doctrine_migrations.dir_name ' => __DIR__ . '/../../ ' ,
52+ 'doctrine_migrations.namespace ' => 'App \\ Migrations ' ,
53+ 'doctrine_migrations.name ' => 'App migrations ' ,
54+ 'doctrine_migrations.table_name ' => 'migrations ' ,
3155 'doctrine_migrations.organize_migrations ' => Configuration::VERSIONS_ORGANIZATION_BY_YEAR ,
56+ 'doctrine_migrations.custom_template ' => 'migrations.tpl ' ,
3257 )));
3358 }
3459}
0 commit comments