Review main Merged

95345[TASK] Limit global backup to stateful unit tests

Wouter Wolters CR +2 V +2 Normal +223 −1 updated 09/10/26, 07:33

Commit message

The PHP unit test configuration enabled backupGlobals for the entire
suite. PHPUnit therefore serialized and restored the complete global
state before and after every test invocation, including tests that
never modify it.

A strict global-state audit of the suite found that only 110 of 731
test classes modify global state. The remaining 620 classes, covering
8,777 test invocations, paid the isolation cost without benefiting
from it.

Disable global backup by default and explicitly enable it with
attribute #[BackupGlobals(true)] the existing isolation where required
while avoiding unnecessary work for the majority of the suite.
New tests that modify global state must opt in using the same attribute.

On PHP 8.5.9, the full suite runtime improves from 24.34 seconds to
16.02 seconds, saving 8.32 seconds or 34.2 percent. A randomized run
completes in 16.80 seconds.

Normal and randomized runs execute all 11,694 tests with unchanged
results. A strict before-and-after audit reports the same 110
state-changing classes and 1,102 unique state-changing invocations,
confirming that no class requiring isolation lost its backup.

Review

  • Code review CR +2 Done
    • Georg Ringer +2
    • Oliver Klee +1
    • Simon Schaufelberger +1
  • Verified V +2 Done
    • Georg Ringer +2
    • Oliver Klee +1
    • Simon Schaufelberger +1
    • core-ci +1 CI

Issues 1

Files 111

Show 91 more files

Review log 1317

  1. Wouter Wolters uploaded patch set 1 08/16/26, 20:13

  2. core-ci voted on patch set 1 V +1 08/16/26, 20:19 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106786

  3. Wouter Wolters updated the commit message in patch set 2 V +1 09/04/26, 14:21

  4. Wouter Wolters marked it ready for review 09/04/26, 14:21

  5. core-ci voted on patch set 2 V +1 09/04/26, 14:28 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/107889

  6. Oliver Klee voted on patch set 2 V +1 09/04/26, 14:29

  7. Oliver Klee voted on patch set 2 CR +1 09/04/26, 14:30

  8. Simon Schaufelberger voted on patch set 2 CR +1 V +1 09/04/26, 14:39

  9. Georg Ringer commented on patch set 2 CR +1 V +1 09/09/26, 05:17

    IMO also something for 14.3
  10. Wouter Wolters updated the commit message in patch set 3 CR +1 V +1 09/09/26, 06:44

  11. core-ci voted on patch set 3 V +1 09/09/26, 06:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108146

  12. Simon Schaufelberger updated the commit message in patch set 4 V +1 09/09/26, 07:19

  13. Simon Schaufelberger voted on patch set 4 CR +1 V +1 09/09/26, 07:19

  14. core-ci voted on patch set 4 V +1 09/09/26, 07:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108147

  15. Oliver Klee voted on patch set 4 CR +1 V +1 09/09/26, 08:35

  16. Georg Ringer voted on patch set 4 CR +2 V +2 09/10/26, 07:33

  17. Georg Ringer merged patch set 5 09/10/26, 07:33