Skip to content

Commit 9956560

Browse files
authored
Merge pull request #46 from barmax/fix/issue-20-loading-environment
Use the testing environment file specified in a suite
2 parents 541642b + bc29ae1 commit 9956560

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
"php": "^8.0",
2323
"ext-json": "*",
2424
"codeception/lib-innerbrowser": "^3.1",
25-
"codeception/codeception": "^5.0.0-RC2"
25+
"codeception/codeception": "^5.0.0-RC2",
26+
"vlucas/phpdotenv": "^5.3"
2627
},
2728
"require-dev": {
2829
"codeception/module-asserts": "^3.0",
2930
"codeception/module-rest": "^3.1",
30-
"laravel/framework": "^8.0",
31-
"vlucas/phpdotenv": "^5.3"
31+
"laravel/framework": "^8.0"
3232
},
3333
"autoload": {
3434
"classmap": ["src/"]

src/Codeception/Lib/Connector/Laravel.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Codeception\Lib\Connector\Laravel6\ExceptionHandlerDecorator as Laravel6ExceptionHandlerDecorator;
1010
use Codeception\Module\Laravel as LaravelModule;
1111
use Codeception\Stub;
12+
use Dotenv\Dotenv;
1213
use Exception;
1314
use Illuminate\Contracts\Config\Repository as Config;
1415
use Illuminate\Contracts\Debug\ExceptionHandler;
@@ -186,7 +187,12 @@ private function loadApplication(): AppContract
186187
{
187188
/** @var AppContract $app */
188189
$app = require $this->module->config['bootstrap_file'];
189-
$app->loadEnvironmentFrom($this->module->config['environment_file']);
190+
if ($this->module->config['environment_file'] !== '.env') {
191+
Dotenv::createMutable(
192+
$app->basePath(),
193+
$this->module->config['environment_file']
194+
)->load();
195+
}
190196
$app->instance('request', new Request());
191197

192198
return $app;

0 commit comments

Comments
 (0)