- @berdir opened merge request.
- π¨πSwitzerland berdir Switzerland
Beside removing a lot of complexity (when and when not to reset cache) and lines of code, it also uncovers bugs and incorrect assumptions in tests when we forget to reset the cache.
For example https://git.drupalcode.org/project/drupal/-/merge_requests/10075/diffs?c.... That test never actually tested what I thought it did, because it was always testing against the original stale entity.
- First commit to issue fork.
- πΊπΈUnited States smustgrave
1) Drupal\Tests\block\Functional\BlockCacheTest::testCachePermissions
Behat\Mink\Exception\ResponseTextException: The text "smx906fw" was not
found anywhere in the text of the current page.Appears to be random but since 100+ commits back now I did a simple rebase to make sure.
I wasn't 100% sure if we should have a CR but since it's just around tests I didn't think it would be needed.
Edit
Rebase was good and green.
Change LGTM
- πΊπΈUnited States bradjones1 Digital Nomad Life
I'm not sure if there is a policy that speaks to this but a CR would be good as this is a pretty important change to the base test setup and is not obvious.
- π¨πSwitzerland berdir Switzerland
Created https://www.drupal.org/node/3491185 β .
This is mostly a DX thing when writing new tests and shouldn't affect any existing tests, except those that implicitly or explicitly rely on the current static cache behavior, like the one example in core that I had to fix.
For new tests, it should now mostly just work without having to think about internal entity features.
Note: I have not verified if every single resetCache() call in core is still needed, but I removed enough to show that this works I think and quite a few are still necessary as their changes are not done by form submissions.