Problem/Motivation

#3573954: Move common code across Drupal base test suite classes to DrupalTestCaseTrait and #3589047: Deprecate TestRequirementsTrait::getDrupalRoot() made some good improvements to the base test classes and trait. They did so with a property hook which meant the changes weren't backported. This complicates ongoing work that touches on DrupalKernel's application root since it can no longer happen across versions.

#3590425: Remove usage of property hook for DrupalTestCaseTrait::$root removed the hook property to allow backporting to 11.x

Steps to reproduce

Proposed resolution

Cherry-pick the following commits to 11.x individually or squash them in one:

Additionally make the following changes:

  • Update the deprecation messages in TestRequirementsTrait, DrupalTestCaseTrait::getDrupalRoot, and BrowserTestBase::setUpAppRoot to indicate the new "in" version
  • Update the associated change record #3574112: TestRequirementsTrait is deprecated to indicate the new "introduced in" branch and version

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3590435

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

kingdutch created an issue. See original summary.

kingdutch’s picture

Title: Backport changes to DrupalTestCaseTrait and related classes from 12.x to 11.x » [PP-1] Backport changes to DrupalTestCaseTrait and related classes from 12.x to 11.x
Status: Active » Postponed
Related issues: +#3590425: Remove usage of property hook for DrupalTestCaseTrait::$root

kingdutch’s picture

Issue summary: View changes

Created one MR for 11.x which includes the backported changes, created another MR for main which includes the updates to the deprecations.

kingdutch’s picture

Title: [PP-1] Backport changes to DrupalTestCaseTrait and related classes from 12.x to 11.x » Backport changes to DrupalTestCaseTrait and related classes from 12.x to 11.x
Status: Postponed » Needs review
mondrake’s picture

MR !15782 is 11.x only and includes backport of #3573954: Move common code across Drupal base test suite classes to DrupalTestCaseTrait , #3589047: Deprecate TestRequirementsTrait::getDrupalRoot() and #3590425: Remove usage of property hook for DrupalTestCaseTrait::$root .

MR !15783 in main only and updates deprecation version to 11.4 instead of 12.

+1 to RTBC, but I wont set it as I worked on quite some of the earlier issues.

mondrake’s picture

Issue summary: View changes
smustgrave’s picture

How come the separate issue vs marking those issues to be backported? Just curious

kingdutch’s picture

How come the separate issue vs marking those issues to be backported? Just curious

Primarily, me trying to navigate the Drupal core process and not breaking things because we only change one of the things, while being a few rabbit holes away from the issue I'm actually trying to fix :)

So making a single issue was the easiest way for me to ensure the changes all get backported and we don't get rifts between 12.x and 11.x because one issue is backported and another is not.

I've kept things as individual commits in the MR, so if rebase instead of squash is used then you still have the original papertrail. In theory we can also move those back to the individual issues; then we need to coordinate the order between those 3.

mondrake’s picture

Status: Needs review » Reviewed & tested by the community

The first one, #3573954: Move common code across Drupal base test suite classes to DrupalTestCaseTrait , as clearly commented in the issue, cannot be backportd as such. It uses a PHP 8.4 language feature (property hook), and Drupal 11 still supports PHP 8.3. If it were backported, the repo would be broken between that commit and the commit of the third backport. Since there is no guarantee that the 3 backports would be committed together before push, a single commit is the safest way.

alexpott’s picture

Version: main » 11.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed d43dcd724b3 to main. Thanks!
Committed and pushed e93d83aef99 to 11.x. Thanks!

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.

  • alexpott committed e93d83ae on 11.x
    task: #3590435 Backport changes to DrupalTestCaseTrait and related...

  • alexpott committed d43dcd72 on main
    task: #3590435 Backport changes to DrupalTestCaseTrait and related...
alexpott’s picture

I updated the CR.