• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Yoast / PHPUnit-Polyfills / 10706891309 / 9
98%
3.x: 98%

Build:
Build:
LAST BUILD BRANCH: 4.x
DEFAULT BRANCH: 3.x
Ran 04 Sep 2024 05:52PM UTC
Files 38
Run time 22s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

04 Sep 2024 05:36PM UTC coverage: 61.035%. Remained the same
10706891309.9

push

github

jrfnl
PHPUnit 11 | ExpectUserDeprecationtrait: polyfill the TestCase::expectUserDeprecation*() methods

PHPUnit 11.0.0 introduces the new `TestCase::expectUserDeprecationMessage()` and `TestCase::expectUserDeprecationMessageMatches()` methods.

These methods can largely be seen as replacements for the `TestCase::expectDeprecationMessage()` and `TestCase::expectDeprecationMessageMatches()` methods which were removed in PHPUnit 10.0, though there are significant differences between the implementation details of the old vs the new methods.

As PHPUnit 10 does not have any even semi-equivalent method(s) available, the challenge was to polyfill these methods for PHPUnit 10.
And as these methods are expectation methods, not assertions, this is even more challenging as the information to evaluate a pass/fail is not available at the time of the method call, but only once the rest of the test code has run.

To do so, the following five options were considered:

**Option 1: evaluate pass/fail in an "assertPostConditions()" method**

While possible, doing so would make the use of the `Yoast\PHPUnitPolyfills\TestCases\TestCase` base class required.
It would also mean deprecating/removing the annotation-based `Yoast\PHPUnitPolyfills\TestCases\XTestCase` class as there is no annotation available to mark a method as an "assertPostConditions()"  method, so the functionality could not work with the `XTestCase` class.

As a knock-on effect of making the use of the Polyfilled `TestCase` a requirement, it would also mean that using of the individual Polyfills as stand-alone traits should be deprecated/no longer be supported.

This chain of consequences was deemed undesirable as it breaks the premise of the Polyfills being a "drop in" helper library.

**Option 2: use Events to evaluate pass/fail**

While possible, doing so would mean that the event listeners would need to be "hooked in" from the PHPUnit config file.
This would mean that every project using the Polyfills and wan... (continued)

401 of 657 relevant lines covered (61.04%)

7.83 hits per line

Source Files on job php-7.3-phpunit-phar-9.0 - 10706891309.9
  • Tree
  • List 38
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 10706891309
  • 0baad9db on github
  • Prev Job for on WIP/3.x (#10706436946.8)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc