- Issue created by @drunken monkey
- Merge request !163Resolve #3470166: Fix test failures against Drupal 11 โ (Merged) created by drunken monkey
- Status changed to Needs work
4 months ago 9:50am 26 August 2024 - ๐ฆ๐นAustria drunken monkey Vienna, Austria
The PHPStan problem is clear (Core added a method in 11.x, so the โthis method doesnโt existโ warning wonโt be displayed anymore), but the two test failures are a bit inexplicable:
- I cannot reproduce the failure in
ExcerptFieldTest
, even though Iโm using the exact same versions as GitLab CI. However, I remember that I already had a problem somewhere with\Drupal::state()
in Functional tests in the CI, so at a hunch I changed the mechanism by which the test tells the alter hook to change the excerpt template used โ and it worked indeed.
There seems to be something broken in GitLab CI when using\Drupal::state()
in Functional tests. (Pity I canโt remember anymore where Iโve seen this before, or howI solved it then.) - The failure in
ViewsDisplayCachingTest
I can reproduce, but not fully explain: it seems Core is to blame here, asAssertViewsCacheTagsTrait::assertViewsCacheTags()
fails to sort both sets of cache tags before comparing them, leading to a bogus comparison failure. Just adding a singlesort($build['#cache']['tags']);
line fixes the problem. But in order to fix this here, we of course have to override the whole method.
Not sure whatโs going on here, it seems something changed in array comparisons between PHP 8.1 and 8.3? But no idea why Core wouldnโt have picked this up.
Anyways, I created an MR with an attempt at fixing the problems, but the solutions for the test failures are both a bit unsatisfactory, so not sure if I should merge this in its current form. Any help or feedback would be much appreciated!
- I cannot reproduce the failure in
- ๐ฆ๐นAustria drunken monkey Vienna, Austria
The MR is indeed passing tests, but I think Iโll wait for feedback still a bit. Would be great to find proper fixes for those problems.
- ๐ฆ๐นAustria drunken monkey Vienna, Austria
Update: mstrelan โ pointed me to the Core issue ๐ sebastianbergmann/comparator:5.0.2 Introduces (for Drupal) breaking changes Fixed , which discusses the problem in
AssertViewsCacheTagsTrait::assertViewsCacheTags()
. So, apparently this will be fixed in Core, and we can just temporarily fix it in this module to make CI pass again. - ๐ฆ๐นAustria drunken monkey Vienna, Austria
Update 2: mstrelan โ and catch โ to the new caching for state introduced in Drupal 10.3 ( ๐ Use cache collector for state Needs review ) and apparently made the default behavior in Drupal 11 ( ๐ Remove state_cache setting in Drupal 11 Fixed ). So, we probably just need to work around that cache in
ExcerptFieldTest
. - ๐จ๐ญSwitzerland berdir Switzerland
drunken monkey โ credited berdir โ .
-
drunken monkey โ
committed 9f654bae on 8.x-1.x
Issue #3470166 by drunken monkey, berdir, catch, mstrelan: Fixed test...
-
drunken monkey โ
committed 9f654bae on 8.x-1.x
- Status changed to Fixed
4 months ago 9:58am 8 September 2024 - ๐ฆ๐นAustria drunken monkey Vienna, Austria
Changed the
ExcerptFieldTest
fix to use a custom key-value store, as suggested. CI passes, so I merged.Also, the Core issue ( ๐ sebastianbergmann/comparator:5.0.2 Introduces (for Drupal) breaking changes Fixed ) has been fixed, so once the
MAX_PHP_VERSION
test uses a Core version with that change included, we can get rid of our custom override toViewsDisplayCachingTest::assertViewsCacheTags()
.
I created ๐ Remove our custom ViewsDisplayCachingTest::assertViewsCacheTags() override Postponed as a follow-up to do that. Automatically closed - issue fixed for 2 weeks with no activity.