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

Created on 3 January 2025, 9 months 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
    9 months ago
    Total: 170s
    #393006
  • Pipeline finished with Failed
    9 months ago
    Total: 211s
    #393011
  • Pipeline finished with Failed
    9 months ago
    Total: 573s
    #393019
  • Pipeline finished with Failed
    9 months ago
    Total: 672s
    #393132
  • Pipeline finished with Failed
    9 months ago
    Total: 458s
    #393490
  • Pipeline finished with Failed
    2 months ago
    #555189
  • Pipeline finished with Failed
    2 months ago
    #555201
  • 🇮🇹Italy mondrake 🇮🇹
  • Pipeline finished with Failed
    2 months ago
    #555287
  • 🇮🇹Italy mondrake 🇮🇹
  • Pipeline finished with Failed
    2 months ago
    Total: 210s
    #557990
  • Pipeline finished with Failed
    2 months ago
    #562695
  • 🇮🇹Italy mondrake 🇮🇹

    https://github.com/sebastianbergmann/phpunit/issues/6102 is fixed upstream, so as soon as a release 11.5.33 hits the road this is actionable again

  • Pipeline finished with Failed
    about 1 month ago
    Total: 104s
    #583081
  • 🇮🇹Italy mondrake 🇮🇹

    With PHPUnit 11.5.34, the facade sealed exception no longer shows, but now we need to complete conversion of all tests to use metadata attributes instead of annotations.

  • Pipeline finished with Failed
    about 1 month ago
    Total: 419s
    #588340
  • Pipeline finished with Failed
    about 1 month ago
    Total: 202s
    #588344
  • Pipeline finished with Failed
    about 1 month ago
    Total: 144s
    #588351
  • Pipeline finished with Failed
    about 1 month ago
    Total: 278s
    #588359
  • Pipeline finished with Failed
    about 1 month ago
    Total: 238s
    #588371
  • Pipeline finished with Failed
    about 1 month ago
    Total: 234s
    #589251
  • Pipeline finished with Failed
    about 1 month ago
    Total: 142s
    #590195
  • Pipeline finished with Canceled
    about 1 month ago
    Total: 167s
    #590209
  • Pipeline finished with Failed
    about 1 month ago
    Total: 579s
    #590215
  • 🇮🇹Italy mondrake 🇮🇹
  • Pipeline finished with Failed
    about 1 month ago
    Total: 507s
    #591006
  • Pipeline finished with Failed
    about 1 month ago
    Total: 185s
    #591330
  • Pipeline finished with Failed
    about 1 month ago
    Total: 707s
    #591332
  • Pipeline finished with Failed
    30 days ago
    Total: 626s
    #591559
  • Pipeline finished with Failed
    30 days ago
    Total: 394s
    #591576
  • Pipeline finished with Failed
    30 days ago
    Total: 287s
    #591714
  • Pipeline finished with Failed
    30 days ago
    Total: 756s
    #591729
  • Pipeline finished with Failed
    30 days ago
    Total: 7240s
    #591788
  • Pipeline finished with Failed
    30 days ago
    Total: 715s
    #591831
  • Pipeline finished with Failed
    27 days ago
    Total: 157s
    #593325
  • Pipeline finished with Failed
    27 days ago
    Total: 545s
    #593605
  • Pipeline finished with Failed
    27 days ago
    Total: 158s
    #593616
  • Pipeline finished with Failed
    18 days ago
    Total: 618s
    #602041
  • Pipeline finished with Failed
    16 days ago
    Total: 112s
    #604015
  • Pipeline finished with Failed
    16 days ago
    #604017
  • Pipeline finished with Failed
    8 days ago
    Total: 320s
    #611029
  • Pipeline finished with Failed
    8 days ago
    Total: 259s
    #611032
  • Pipeline finished with Failed
    8 days ago
    #611036
Production build 0.71.5 2024