Deprecate expectDeprecation(), use PHPUnit's expectUserDeprecationMessage() instead

Created on 3 January 2025, 21 days ago

Problem/Motivation

When we started using PHPUnit 10, we dropped the dependency to symfony/phpunit-bridge, and added our own custom DeprecationHandler to replace it.

Quite a few parts of the Symfony code were included in the replacement, to allow BC, including the expectDeprecation() method to be used in tests to check deprecations messages are actually triggered.

In the meantime, PHPUnit evolved and in version 11.0, the expectUserDeprecationMessage() and expectUserDeprecationMessageMatches() methods were introduced with basically the same purpose.

https://github.com/sebastianbergmann/phpunit/blob/11.0.10/ChangeLog-11.0...

Proposed resolution

  • Wait for PHPUnit 11 to be supported
  • Deprecate expectDeprecation (pun moderately intended), and replace its usage with expectUserDeprecationMessage*
  • Cleanup DeprecationHandler no longer necessary

NOTE: differently from expectDeprecation, there is no check in PHPUnit that expectUserDeprecationMessage* are only called within deprecation tests (those marked @group legacy or #[IgnoreDeprecations]). Need to be careful about this.

Remaining tasks

TBD

Follow ups

TBD

📌 Task
Status

Postponed

Version

11.0 🔥

Component

phpunit

Created by

🇮🇹Italy mondrake 🇮🇹

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

Merge Requests

Comments & Activities

  • Issue created by @mondrake
  • 🇮🇹Italy mondrake 🇮🇹
  • Merge request !10871Draft: Closes #3497124 → (Open) created by mondrake
  • Pipeline finished with Failed
    13 days ago
    Total: 170s
    #393006
  • Pipeline finished with Failed
    13 days ago
    Total: 211s
    #393011
  • Pipeline finished with Failed
    13 days ago
    Total: 573s
    #393019
  • Pipeline finished with Failed
    12 days ago
    Total: 672s
    #393132
  • Pipeline finished with Failed
    12 days ago
    Total: 458s
    #393490
Production build 0.71.5 2024