File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -183,6 +183,17 @@ protected function configureRoutes($routes): void
183183
184184 public function shutdown (): void
185185 {
186+ if ($ this ->booted && $ this ->clearCache ) {
187+ // KernelTestCase wants the services_resetter service to be instantiated as part of
188+ // its resetting in `ensureKernelShutdown`. However, if we clear the cache, the
189+ // compiled container will break when trying to load the file containing the compiled
190+ // code for that service as we would have deleted it already.
191+ // This runs before calling the parent method so that the container is still available.
192+ if ($ this ->container ->has ('services_resetter ' )) {
193+ $ this ->container ->get ('services_resetter ' )->reset ();
194+ }
195+ }
196+
186197 parent ::shutdown ();
187198
188199 if (!$ this ->clearCache ) {
You can’t perform that action at this time.
0 commit comments