Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
The TestWaitTerminate middleware is added for all functional tests, but it's only needed by tests that use WaitTerminateTestTrait
. This is likely to be a small performance hit on functional and functional js tests.
I think we could move the middleware to a testing module, then enable that module on all the tests that use the trait
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Issue fork drupal-3436971
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
catchComment #3
catchFrom @alexpott:
Comment #5
BerdirI had a look at this, and that makes sense, I'm just not exactly sure how change it to that from where we are. The current trait sets state flag which I guess you can do anytime within the test. We could rebuild the container when the method is called and write the file then, but that seems complicated and requires reading, parsing and writing it again, or writing another file that we include?
That method currently needs to be called after setup obviously, while a new one would need to be called before to avoid extra rebuilds and complexity.
Maybe we should just deprecate the trait entirely in favor of a flag in the test base or a trait used there, like \Drupal\Core\Test\TestSetupTrait::$strictConfigSchema. For BC, we check if the trait is present and then do it to?
Comment #6
catchCould we set the flag in the same trait, deprecate the method (docs-only deprecation I guess to start with because it'll break tests if we @trigger_error), and use it like that?
Comment #7
BerdirI think the logic for writing the services.yml file needs to be in \Drupal\Core\Test\FunctionalTestSetupTrait::prepareSettings, that's why my proposal is to deprecate the trait entirely and just have the flag there.