Problem/Motivation
NodeTypeForm allows you to change the label of the title field. There is no test for this functionality, but in Group I copied the code almost verbatim and I did write a test for this. Now this test started failing as of Drupal 11.3.0
See test here: https://git.drupalcode.org/project/group/-/blob/4.0.x/tests/src/Function...
See failure here: https://git.drupalcode.org/project/group/-/jobs/7381790/viewer#L304, that failure does not occur on other core branches.
If I change the test to add $this->entityFieldManager->clearCachedFieldDefinitions();, it goes green again. After some digging I found that the entity field manager's caches are now warm when the test starts running, meaning the changes we make on submit in NodeTypeForm are not recognized by the test unless we use RefreshVariablesTrait or manualy flush caches: https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/node/...
Steps to reproduce
View test in MRs and see that it didn't use to break and now it does. This because of warm caches at test start.
Proposed resolution
- Figure out what changed to always make these caches warm
- Add a test for NodeTypeForm to demonstrate the behavior
Remaining tasks
User interface changes
N/A
Introduced terminology
N/A
API changes
N/A
Data model changes
Release notes snippet
Issue fork drupal-3559201
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
kristiaanvandeneyndeComment #3
kristiaanvandeneyndeI just realized there may be something that now loads the entity field definitions on any page, thus warming the cache, and then our request to the form will not affect the cache on the test instance. That's what we have RefreshVariablesTrait for.
So now the question is, if that's the case, what made us load the field definitions on any request?
Comment #6
kristiaanvandeneyndeWe can probably also fix the test by visiting the node form before and after changing the label field and seeing if that went through. But the fact that, from 11.2.x to 11.3.x, suddenly the entity field manager's caches are warm on any given test run concerns me.
Comment #7
kristiaanvandeneyndeComment #8
kristiaanvandeneyndeComment #9
kristiaanvandeneyndeUsing git bisect found the culprit: #3538006: Optimize EntityFieldManager::buildBundleFieldDefinitions()
Comment #10
quietone commentedJust updating version.
Comment #11
kristiaanvandeneyndeThis looks intentional after verification through git bisect. It did catch me off guard, though, that's for sure :)