Skip to content

Commit

Permalink
fixed running only unit tests by defining DB_DSN while bootstrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
craue committed Aug 31, 2023
1 parent 8c3ab2a commit 0e34cf9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 0 additions & 1 deletion Tests/IntegrationTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ protected static function createKernel(array $options = []) : KernelInterface {
// ensure different caches are used for each database flavor
if (!empty($_ENV['DB_FLAVOR'])) {
$environment .= '_' . $_ENV['DB_FLAVOR'];
$_ENV['DB_DSN'] = $_ENV['DB_DSN_' . strtoupper($_ENV['DB_FLAVOR'])];
}

return new AppKernel($environment, $configFile);
Expand Down
5 changes: 5 additions & 0 deletions Tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

if (!empty($_ENV['DB_FLAVOR'])) {
$_ENV['DB_DSN'] = $_ENV['DB_DSN_' . strtoupper($_ENV['DB_FLAVOR'])];
}
1 change: 1 addition & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
backupGlobals="false"
bootstrap="Tests/bootstrap.php"
cacheResult="false"
colors="true"
failOnRisky="true"
Expand Down

0 comments on commit 0e34cf9

Please sign in to comment.