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
5 changes: 3 additions & 2 deletions system/Boot.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,9 @@ public static function preload(Paths $paths): void
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();

$envDir = $paths->envDirectory ?? dirname($paths->appDirectory); // @phpstan-ignore nullCoalesce.property
(new DotEnv($envDir))->load();
}

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 @@ -54,6 +54,10 @@
require CONFIGPATH . 'Paths.php';
$paths = new Paths();

// Use a controlled environment directory for tests so that
// separate-process tests don't fail on an unreadable .env file.
$paths->envDirectory = $paths->testsDirectory;

// Define necessary framework path constants
defined('APPPATH') || define('APPPATH', realpath(rtrim($paths->appDirectory, '\\/ ')) . DIRECTORY_SEPARATOR);
defined('ROOTPATH') || define('ROOTPATH', realpath(APPPATH . '../') . DIRECTORY_SEPARATOR);
Expand Down
Loading