Skip to content

Conversation

@cosmastech
Copy link
Contributor

@cosmastech cosmastech commented Nov 13, 2025

I'll be honest, I'm not entirely sure why this has fixed the problem described here. #57663 (comment) I've stepped through this many times and I am still lost about what this change is preventing from happening. I can see it has something to do with caching the config before calling the parallel testing provider, but... yeah, I'm still a touch confused.

For whatever it's worth, I thought that I wanted to set the application to cached before booting to avoid a disk read on LoadEnvironmentVariables, however, TIL that Env keeps a static instance of the environment variables stored. Turns out that wasn't necessary.

Thanks to @santigarcor for bringing this to my attention.

@SanderMuller
Copy link
Contributor

@cosmastech I tried this change locally in our project, and it causes errors in some tests, for example a test that renders a page containing a NoCaptcha from the https://github.com/anhskohbo/no-captcha package.

Specifically on GuzzleHttp\Client::__construct(): Argument #1 ($config) must be of type array, null given from Anhskohbo\NoCaptcha\NoCaptchaServiceProvider::register()

    public function register()
    {
        $this->app->singleton('captcha', function ($app) {
            return new NoCaptcha(
                $app['config']['captcha.secret'],
                $app['config']['captcha.sitekey'],
                $app['config']['captcha.options']
            );
        });
    }

This test works fine with $this->markConfigCached($app);

@cosmastech
Copy link
Contributor Author

@cosmastech I tried this change locally in our project, and it causes errors in some tests, for example a test that renders a page containing a NoCaptcha from the https://github.com/anhskohbo/no-captcha package.

Specifically on GuzzleHttp\Client::__construct(): Argument #1 ($config) must be of type array, null given from Anhskohbo\NoCaptcha\NoCaptchaServiceProvider::register()

    public function register()
    {
        $this->app->singleton('captcha', function ($app) {
            return new NoCaptcha(
                $app['config']['captcha.secret'],
                $app['config']['captcha.sitekey'],
                $app['config']['captcha.options']
            );
        });
    }

This test works fine with $this->markConfigCached($app);

Thanks for reporting this @SanderMuller. I will mark this as draft and continue my spelunking.

@cosmastech cosmastech marked this pull request as draft November 14, 2025 11:00
Comment on lines +196 to +200
if (! isset(self::$originalDatabaseName)) {
self::$originalDatabaseName = $database;
} else {
$database = self::$originalDatabaseName;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: I think that this trait/approach needs refactored to work with multiple database connections. Currently, I don't believe that multiple connections are seeded/migrated. This approach is a little bit naive and assumes (like the rest of the parallel runner code) that there's but a single database to be concerned with.

@cosmastech cosmastech marked this pull request as ready for review November 14, 2025 15:12
@taylorotwell taylorotwell merged commit 4ae5893 into laravel:12.x Nov 14, 2025
66 checks passed
@cosmastech cosmastech deleted the patch-28 branch November 15, 2025 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants