Problem/Motivation

Drupal 12 requires PHP 8.5 and PHPUnit 12.5. The 2.x series runs next-major CI jobs against Drupal 12, allowed to fail, but until this issue they stopped at the Composer step, so no test had run on Drupal 12.

Project Update Bot never opened an automated compatibility issue for this project, because its analysis fails at composer require drupal/mongodb: its Drupal 11 run reports ext-mongodb as missing from its environment. This issue takes its place.

Proposed resolution

Done in earlier issues:

Done in MR !55:

  • Core requirement: core_version_requirement: ^12.0 || ^11.3 || ^10.6 in all four .info.yml files, test module included.
  • Tests, since PHPUnit 12 no longer reads annotations:
    • Attributes (#[CoversClass], #[Group], #[DataProvider]) beside the annotations, which PHPUnit 9 still reads on Drupal 10.
    • @coversDefaultClass becomes a class-level @covers, and method-level @covers ::method are removed: PHPUnit 11 reports them as invalid once a class has attributes, and PHPUnit 12 has no method-level targets.
    • #[RunTestsInSeparateProcesses] on every concrete kernel and functional test class: deprecated without it since Drupal 11.3, an exception in Drupal 12.0 (change record).
    • ControllerTest no longer calls xpath(), deprecated in Drupal 11.5 (change record). It calls Mink's findAll() directly, which works the same on Drupal 10 to 12.
  • Requirements: Drupal 11.3 deprecates procedural hook_requirements() without #[LegacyRequirementsHook] (change record), and Drupal 12 removes the REQUIREMENT_* constants.
    • Runtime and update checks move to OOP hooks in src/Hook/, and install checks to InstallRequirementsInterface classes in src/Install/Requirements/.
    • The procedural hook_requirements() remains as a #[LegacyRequirementsHook] wrapper, so Drupal 10 runs the same checks.
    • A Severity helper maps severities to the RequirementSeverity enum or to the constants, depending on the core version.
  • Bugs fixed on the way, in the requirements checks:
    • MongoDB errors and warnings were reported as OK on the status report.
    • Installing MongoDB Watchdog without $settings['mongodb'] threw a TypeError. It now reports a requirement error.
    • The request tracking message had a stray </a>. At runtime, it now links to the MongoDB Watchdog settings form.

Related, not required by Drupal 12:

Remaining tasks

  • Drush commands: they are still declared in drush.services.yml, which Drush 13 marks as deprecated. Check whether Drush 14 still loads it once it has a stable release, and move the commands to attributes if not.

User interface changes

On the status report, MongoDB errors and warnings now show with their real severity, and the request tracking message links to the MongoDB Watchdog settings form.

API changes

  • core_version_requirement now includes ^12.0.
  • Drupal\mongodb_watchdog\Install\Requirements is renamed RequirementsChecker, with no alias. Its service ID, mongodb.watchdog_requirements, is unchanged.

Data model changes

None.

AI disclosure

Issue and MR are AI-assisted.

Issue fork mongodb-3626729

Command icon 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

fgm created an issue. See original summary.

fgm’s picture

Issue tags: +Drupal 12
fgm’s picture

Issue tags: -Drupal 12

fgm’s picture

Issue summary: View changes

  • fgm committed 48fdf33e on 8.x-2.x
    Issue #3626729: Drupal 12 early compatibility
    
    - replace annotations by...
fgm’s picture

Status: Active » Fixed

Merged to today's HEAD.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

fgm’s picture

Issue summary: View changes
matthand’s picture

Wow you're really on a hot streak! Way to go @fgm!