[NFC] Unit test fixes for the problem of quickform rules going missing #21725
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
For a while now there's been a problem with certain form tests where the quickform rules go missing.
Before
Several attempts at workarounds.
After
Don't need workarounds
Technical Details
Note this line:
civicrm-core/tests/phpunit/CRM/Core/DAOConformanceTest.php
Lines 28 to 29 in 3e2bee6
That's in a dataprovider that runs BEFORE anything even starts. So there's some time-travel mindbending going on - calling setup before setup.
It's nice to have the dataprovider but moving it to a loop inside the actual function works and avoids the problems. It looks complicated in the github view but that's the main change here.
Comments
There is still one annotation remaining that starts a test in a separate process. That's a different issue and it doesn't seem to hurt at the moment, but may need revisiting.