Issue #3619663 by marcelovani: Add Drupal 12 support

Four separate things were in the way, and only the last is the sort of change a version bump implies.

The token hooks throw

Drupal 12 no longer loads MODULE.tokens.inc before invoking the hook. It registers dfp_tokens from the file scan and then cannot resolve it:

InvalidArgumentException: Class "dfp_tokens" does not exist.
  in Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition()

Not a test failure — any request that replaces a token, once dfp is installed. Core made the same move and now ships no .tokens.inc files at all, every one having become a *TokensHooks class. The implementations move to src/Hook/DfpTokensHooks.php; the procedural functions stay behind LegacyHook so 10.3 and 11 are unaffected.

HtmlResponseAttachmentsProcessor gained an argument

Constructing HtmlResponseAttachmentsProcessor without a file url generator is
deprecated in drupal:11.4.0 and the argument will be required in drupal:12.0.0

DfpHtmlResponseAttachmentsProcessor subclasses it and did not pass one, so the parent fell back to \Drupal::service() and the unit tests died with ContainerNotInitializedException. Passing the extra argument is harmless on older core — PHP ignores it.

The suite was not discovered

MissingGroupException — 12 reads the Group attribute rather than the @group annotation, so nothing ran at all. Five classes gained it, and the functional ones RunTestsInSeparateProcesses.

TagViewTest needed DataProvider attributes alongside its annotations rather than instead of them. PHPUnit 9 on Drupal 10 reads only the annotation, PHPUnit 12 only the attribute — replacing them passes on 12 and breaks 10. I did that first and only caught it by running 10.

submitForm() and TranslatableMarkup

WebAssert::buttonExists() no longer accepts one.

Results

Core Result
10.6.15 27 pass
11.4.5 27 pass
12.0-dev (PHP 8.5.8) 27 pass

Before this branch the suite did not run on 12 at all.

The phpcs and phpstan findings that remain — two "String concat is not required" in the test files, and some new static() and entity storage warnings — all predate this and are untouched.

Merge request reports

Loading
Loading