Check that #[RunTestsInSeparateProcesses] attribute is added to all Kernel and Functional tests

Created on 10 September 2025, 5 days ago

Problem/Motivation

Since PHPUnit 10, process isolation must be specified on a single class level or as a global CLI/config switch.

This would cause issues because Drupal needs to run Unit tests NOT in isolation for performance reasons.

For that purpose, workarounds were introduced to programmatically set process isolation in the test constructor.

However, in PHPUnit 12 that is no longer possible as the test constructor can no longer be overridden, and trying to intervene in the setUp() method is already too late for process isolation.

The #[RunTestsInSeparateProcesses] attribute works but needs to be set on each concrete test class, it can not be specified on abstract base classes.

Proposed resolution

In this issue, introduce a check that throws a deprecation if the #[RunTestsInSeparateProcesses] attribute is not specified on the concrete test class.

Then, in the parent, adding #[RunTestsInSeparateProcesses] attribute to all Kernel and Functional tests, through an automated Rector script.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

📌 Task
Status

Needs review

Version

11.0 🔥

Component

phpunit

Created by

🇮🇹Italy mondrake 🇮🇹

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

No activities found.

Production build 0.71.5 2024