Skip to content

Commit 5422d7f

Browse files
committed
make migrations_paths optional
1 parent 521d070 commit 5422d7f

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

DependencyInjection/Configuration.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ public function getConfigTreeBuilder() : TreeBuilder
4848
->children()
4949
->arrayNode('migrations_paths')
5050
->info('A list of namespace/path pairs where to look for migrations.')
51-
->isRequired()
52-
->requiresAtLeastOneElement()
51+
->defaultValue([])
5352
->useAttributeAsKey('namespace')
5453
->prototype('scalar')->end()
5554
->end()

Tests/DependencyInjection/DoctrineMigrationsExtensionTest.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,19 @@ public function testFullConfig() : void
8787
$this->assertConfigs($config);
8888
}
8989

90-
public function testNoConfig() : void
90+
public function testNoConfigsAreNeeded() : void
9191
{
92-
$this->expectException(InvalidConfigurationException::class);
93-
$this->expectExceptionMessage('The child node "migrations_paths" at path "doctrine_migrations" must be configured.');
94-
9592
$container = $this->getContainer([]);
9693

9794
$conn = $this->createMock(Connection::class);
9895
$container->set('doctrine.dbal.default_connection', $conn);
9996
$container->compile();
10097

101-
$container->get('doctrine.migrations.configuration');
102-
}
98+
$config = $container->get('doctrine.migrations.configuration');
10399

100+
self::assertInstanceOf(Configuration::class, $config);
101+
self::assertSame([], $config->getMigrationDirectories());
102+
}
104103

105104
private function assertConfigs(?object $config) : void
106105
{

0 commit comments

Comments
 (0)