Skip to content

Commit 0e34cf9

Browse files
committed
fixed running only unit tests by defining DB_DSN while bootstrapping
1 parent 8c3ab2a commit 0e34cf9

3 files changed

Lines changed: 6 additions & 1 deletion

File tree

Tests/IntegrationTestCase.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ protected static function createKernel(array $options = []) : KernelInterface {
4343
// ensure different caches are used for each database flavor
4444
if (!empty($_ENV['DB_FLAVOR'])) {
4545
$environment .= '_' . $_ENV['DB_FLAVOR'];
46-
$_ENV['DB_DSN'] = $_ENV['DB_DSN_' . strtoupper($_ENV['DB_FLAVOR'])];
4746
}
4847

4948
return new AppKernel($environment, $configFile);

Tests/bootstrap.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
if (!empty($_ENV['DB_FLAVOR'])) {
4+
$_ENV['DB_DSN'] = $_ENV['DB_DSN_' . strtoupper($_ENV['DB_FLAVOR'])];
5+
}

phpunit.xml.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
55
backupGlobals="false"
6+
bootstrap="Tests/bootstrap.php"
67
cacheResult="false"
78
colors="true"
89
failOnRisky="true"

0 commit comments

Comments
 (0)