Skip to content

Commit 186825a

Browse files
committed
[ci] handle when@test for doctrine
1 parent 73ecf23 commit 186825a

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/Test/MakerTestRunner.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,21 @@ public function configureDatabase(bool $createSchema = true): void
178178

179179
// Flex includes a recipe to suffix the dbname w/ "_test" - lets keep
180180
// things simple for these tests and not do that.
181-
$this->removeFromFile(
182-
'config/packages/test/doctrine.yaml',
183-
"dbname_suffix: '_test%env(default::TEST_TOKEN)%'"
184-
);
181+
$this->modifyYamlFile('config/packages/doctrine.yaml', function (array $config) {
182+
if (isset($config['when@test']['doctrine']['dbal']['dbname_suffix'])) {
183+
unset($config['when@test']['doctrine']['dbal']['dbname_suffix']);
184+
}
185+
186+
return $config;
187+
});
188+
189+
// @legacy DoctrineBundle 2.4 recipe uses when@test instead of a test/doctrine.yaml config
190+
if ($this->filesystem->exists('config/packages/test/doctrine.yaml')) {
191+
$this->removeFromFile(
192+
'config/packages/test/doctrine.yaml',
193+
"dbname_suffix: '_test%env(default::TEST_TOKEN)%'"
194+
);
195+
}
185196

186197
// this looks silly, but it's the only way to drop the database *for sure*,
187198
// as doctrine:database:drop will error if there is no database

0 commit comments

Comments
 (0)