Needs work
Project:
Drupal core
Version:
main
Component:
phpunit
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
9 Jul 2026 at 00:03 UTC
Updated:
14 Jul 2026 at 11:06 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
joachim commentedThis is going to affect persistent servers too.
Comment #3
catchWe could use the cache.memory bin for this, and then reset the cache.memory bin after each kernel test drupalGet() request maybe?
For persistent servers we're probably going to need some kind of request-aware memory cache backend - some things should be per-request but not everything. But going from cache.memory to that theoretically new backend would be changing a service name then.
Comment #5
mstrelan commentedSo apparently symfony has a
ResettableServicePassthat is designed to reset this sort of thing. I reasoned with Claude about this and we came up with this approach. In runtime code we call reset inDrupalKernel::terminate.That's not called by kernel tests so we call it from a newHttpKernelTestBrowserclass, which coincidentally I've also introduced in #3566881: Add a submitForm() method to HttpKernelUiHelperTrait. Then we just need to tag services that need to be reset and implementResetInterface, which many services already do.The test conversion here is cherry-picked from #3588363: Convert some tests in Drupal\FunctionalTests namespace to kernel tests, we don't need to review it here. The main thing it doesn't need to reset the pager state itself.
Also note the ResettableServicePass moves from symfony/http-kernel to symfony/dependency-injection in symfony 8.1.
Comment #6
mstrelan commentedPushed a commit to use an event subscriber instead of resetting this in two places. The testbot is not kind to me today. FWIW symfony resets this in kernel boot, but that won't help us with multiple requests in kernel tests.
Comment #7
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.