-
Notifications
You must be signed in to change notification settings - Fork 11.7k
[12.x] Introduce WithCachedConfig testing trait
#57663
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
Conversation
| { | ||
| $app->instance('config_loaded_from_cache', true); // I'm not sure this is actually needed | ||
|
|
||
| LoadConfiguration::setAlwaysUseConfig(static fn () => CachedState::$cachedConfig); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any concern here about someone storing an object in cache that can be modified between tests? We could serialize/unserialize it on each test. This would cost some CPU cycles for each test, but could insulate us from that problem. Not sure how often people are storing mutable objects in their configurations 🤔
Building off of #57623
This change has two benefits:
We cache the. This has been moved into its own PR: [12.x] Cache the result ofApplication@configurationIsCached()check, so this will benefit anyone running the app to reduce unnecessary repeated file_exists() for the cached configconfigurationIsCached()#57665On our pipeline, I observed the following:
WithCachedRoutes: 05:41.584WithCachedRoutesandWithCachedConfig: 04:28.769 🤯