-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix loading incorrect values from config/app.php #9
base: master
Are you sure you want to change the base?
Fix loading incorrect values from config/app.php #9
Conversation
…re reading the application configuration from config/app.php
fd2c22a
to
e3776c3
Compare
What issue does this change fix? |
I have return [
...
'url' => env('APP_URL', 'https://example.com'),
....
]; and
and code if (is_null($request)) {
$appConfig = require $this->module->config['project_dir'] . 'config/app.php';
$request = SymfonyRequest::create($appConfig['url']);
} return wrong |
Is there anything that can be done to get this incorporated? I ran into this same problem in an application that was upgraded from Laravel 6.x and Codeception 3.1.2 to Laravel 7.x and Codeception 4.1.13. Tests executed normally in Laravel 6 but then the I had to pull in these changes locally to get the tests working again in the project. |
Hey @alexey-shapilov and @davidstoker we are talking about unit tests, right? I have not been able to reproduce this error in # config/app.php
'url' => env('APP_URL', 'https://example.com'), # env.testing
APP_URL=http://localhost /** @var Laravel5 $module */
$module = $this->getModule('Laravel5');
$appConfig = require $module->config['project_dir'] . 'config/app.php';
// $appConfig['url'] is 'http://localhost' as expected
$request = SymfonyRequest::create($appConfig['url']); |
@TavoNiievez Yes, it occurs on my unit suite though I have multiple suites and see this occurring on other suite types too. The ordering of the The |
@alexey-shapilov and @davidstoker Ok, a few things have happened in the last few days: First, this module has a new home in https://github.com/Codeception/module-laravel, and this repository will be deprecated shortly. If it turns out that it is a problem that is still present in version I can merge it as long as it doesn't affect the current tests. The version 2.0 release description may be helpful too. |
Hi @TavoNiievez, thanks for the follow-up here. I tried the 2.0 release and observed the same behavior straight away. In looking further and comparing your attempt to reproduce, I had this defined in
Since
If I change my config to have a default value, this works with the 2.0 release and should work with this older version too. This does result in the Symfony Request being instantiated with I observed my tests still working correctly and using the The same change suggested here works in |
@davidstoker thanks for your research, your time is greatly appreciated. What catches my attention is that according to @alexey-shapilov, he also had the config with a default value...
maybe he should change So there are two possible ways here:
|
Bootstrapping Laravel Kernel (to load environment variables from file) before reading the application configuration from config/app.php