Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion system/Boot.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use Config\Optimize;
use Config\Paths;
use Config\Services;
use InvalidArgumentException;

/**
* Bootstrap for the application
Expand Down Expand Up @@ -206,7 +207,11 @@ protected static function loadDotEnv(Paths $paths): void
{
require_once $paths->systemDirectory . '/Config/DotEnv.php';
$envDirectory = $paths->envDirectory ?? $paths->appDirectory . '/../'; // @phpstan-ignore nullCoalesce.property
(new DotEnv($envDirectory))->load();

try {
(new DotEnv($envDirectory))->load();
} catch (InvalidArgumentException) {
}
}

protected static function defineEnvironment(): void
Expand Down
4 changes: 4 additions & 0 deletions system/Test/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@
* and fires up an environment-specific bootstrapping.
*/

// Use a controlled environment directory for tests to avoid
// separate-process tests failing on an unreadable .env file.
$paths->envDirectory = TESTPATH;

// LOAD THE FRAMEWORK BOOTSTRAP FILE
require $paths->systemDirectory . '/Boot.php';
Boot::bootTest($paths);
Expand Down
Loading