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

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

Build:
Build:
LAST BUILD BRANCH: 4.x
DEFAULT BRANCH: 3.x
Repo Added 17 Nov 2022 01:11PM UTC
Files 33
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

LAST BUILD ON BRANCH feature/3.x/new-expectuserdeprecation-polyfill-trait
branch: feature/3.x/new-expectuserdeprecation-polyfill-trait
CHANGE BRANCH
x
Reset
  • feature/3.x/new-expectuserdeprecation-polyfill-trait
  • 1.1.0
  • 1.1.1
  • 1.1.2
  • 1.1.3
  • 1.1.4
  • 1.1.5
  • 1.x
  • 2.0.0
  • 2.0.1
  • 2.0.2
  • 2.0.3
  • 2.0.4
  • 2.0.5
  • 2.0/phpunit-10/update-environment-and-ci
  • 2.0/update-readme-changelog
  • 2.x
  • 3.0.0
  • 3.1.0
  • 3.1.1
  • 3.1.2
  • 3.x
  • 4.0.0
  • 4.0/feature/drop-support-for-php-lt-7.1
  • 4.x
  • JRF/1.x/add-phpstan
  • JRF/2.x/add-phpstan
  • JRF/CS/update-phpcs-ruleset-yoastcs-3.0.0
  • JRF/composer-add-security-link
  • JRF/composer-dont-write-lock-file
  • JRF/composer-tweaks
  • JRF/dependabot-update-config
  • JRF/docs-various-improvements
  • JRF/docs-various-tweaks
  • JRF/feature/remove-dependabot-reviewers
  • JRF/ghactions-add-merge-conflict-check
  • JRF/ghactions-php-8.3-update
  • JRF/ghactions-remove-phpunit-10-trial
  • JRF/ghactions-switch-to-coveralls-reporter
  • JRF/ghactions/dont-fail-on-8.4
  • JRF/gitattributes-minor-tweaks
  • JRF/release-checklist-update
  • JRF/removed-unused-use-statement
  • JRF/update-yoastcs-3.2.0
  • JRF/various-minor-ci-tweaks
  • TEMP/123p0712p37
  • TEMP/2123-testing
  • TEMP/21328039
  • TEMP/2183621p
  • TEMP/test-123
  • TESTING/2.x
  • WIP/3.x
  • dependabot/github_actions/1.x/DavidAnson/markdownlint-cli2-action-16
  • dependabot/github_actions/1.x/DavidAnson/markdownlint-cli2-action-17
  • dependabot/github_actions/1.x/DavidAnson/markdownlint-cli2-action-18
  • dependabot/github_actions/1.x/DavidAnson/markdownlint-cli2-action-19
  • dependabot/github_actions/1.x/DavidAnson/markdownlint-cli2-action-20
  • dependabot/github_actions/1.x/actions/checkout-5
  • dependabot/github_actions/1.x/actions/setup-node-4
  • dependabot/github_actions/1.x/actions/setup-node-5
  • dependabot/github_actions/1.x/actions/setup-node-6
  • dependabot/github_actions/1.x/ramsey/composer-install-3
  • dependabot/github_actions/1.x/xt0rted/markdownlint-problem-matcher-3
  • dependabot/github_actions/actions/checkout-4
  • documentation/custom-approach-expectdeprecations
  • feature/1.x-ghactions-use-nightly-for-php-next
  • feature/1.x-minor-updates-for-start-of-3.x-branch
  • feature/1.x-php-8.4-restrict-test
  • feature/1.x-readme-update-for-polyfills-3.x
  • feature/1.x/changelog-v1.1.4
  • feature/1.x/changelog-v1.1.5
  • feature/2.x-changelog-2.0.2
  • feature/2.x-readme-update-links-to-docs
  • feature/2.x/add-attributes-for-annotations
  • feature/2.x/changelog-v2.0.4
  • feature/2.x/changelog-v2.0.5
  • feature/2.x/ghactions-stop-testing-against-phpunit-dev
  • feature/2.x/readme-updates
  • feature/2.x/tests-minor-fix
  • feature/214-support-phpunit-11.5.0
  • feature/3.x/allow-for-phpunit-11
  • feature/3.x/assertislist-sync-error-message-with-upstream
  • feature/3.x/changelog-v3.1.2
  • feature/3.x/drop-support-for-assertattributehelper
  • feature/3.x/drop-support-for-php-7.0
  • feature/3.x/drop-support-for-phpunit-lt-64
  • feature/3.x/ghactions-stop-testing-against-phpunit-dev
  • feature/3.x/new-assertarraywithlistkeys-polyfill-trait
  • feature/3.x/new-assertobjectnotequals-polyfill-trait
  • feature/3.x/sync-with-phpunit-11
  • feature/4.x/changelog-v4.0.0
  • feature/README-fix-broken-links
  • feature/add-pr-template
  • feature/assertContainsNotOnlyInstancesOf-fix-param-name
  • feature/assertistype-extra-test-closed-resource
  • feature/assertistypetest-remove-redundant-comment
  • feature/assertobjectequalstests-fix-php-8.4-deprecation
  • feature/autoload-add-minor-extra-defensive-coding
  • feature/changelog-1.1.0
  • feature/changelog-1.1.1-release
  • feature/changelog-1.1.3
  • feature/changelog-2.0.1-release
  • feature/changelog-2.0.3
  • feature/changelog-3.1.0
  • feature/changelog-3.1.1
  • feature/composer-ci-allow-for-phpunit-12
  • feature/composer-lint-scripts-cleanup
  • feature/composer-update-dependencies
  • feature/consistently-use-since-tags
  • feature/cs-minor-fixes
  • feature/cs-minor-ruleset-cleanup
  • feature/dependabot-remove-composer
  • feature/drop-support-for-phpunit-lt-7.5-1
  • feature/equaltospecializations-minor-clean-up
  • feature/fix-phpstan-config
  • feature/fix-runtime-deprecations-php-8.5
  • feature/ghactions-add-actionlint
  • feature/ghactions-add-phar-testing-job
  • feature/ghactions-fix-more-rate-limiting
  • feature/ghactions-fix-phpunit-dev-test-run
  • feature/ghactions-improve-dont-run-cronjobs-on-forks-condition
  • feature/ghactions-make-the-test-workflow-more-robust
  • feature/ghactions-php-nightly-is-now-8.6
  • feature/ghactions-reduce-rate-limit-issues
  • feature/ghactions-reinstate-token-for-setup-php
  • feature/ghactions-test-against-phpunit-10-php-8.4
  • feature/ghactions-update-for-setup-php-2.35.0
  • feature/ghactions-update-markdownlint
  • feature/ghactions-use-phpstan-1.0
  • feature/ghactions-workflow-docs
  • feature/improve-php-8.4-workaround-implicitly-nullable
  • feature/markdown-fixes
  • feature/minor-updates-for-4.x
  • feature/modernize-const-visibility
  • feature/modernize-type-declarations
  • feature/partially-revert-URL-changes
  • feature/phpstan-2.0-update
  • feature/phpstan-config-minor-simplification
  • feature/phpstan-fix-config
  • feature/phpunit-9.6.11-add-assertobjecthaspropertytrait
  • feature/phpunit-config-fix-typo
  • feature/phpunit-rename-config-file
  • feature/readme-improve-assertistype-table-format
  • feature/release-version-3.0
  • feature/remark-link-check-tweak
  • feature/remarklint-ignore-release-compare-links
  • feature/support-phpunit-8.5.38-9.6.19
  • feature/support-phpunit-8.5.38-9.6.19_-10.5.17
  • feature/test-docs-minor-update
  • feature/tweak-markdown-workflow
  • feature/update-for-changed-message-format
  • feature/update-xtestcasetest
  • feature/work-round-phpcs-bug
  • main

06 Sep 2024 09:15PM UTC coverage: 97.504% (+0.06%) from 97.444%
10745357966

Pull #200

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)
Pull Request #200: PHPUnit 11 | ExpectUserDeprecationtrait: polyfill the TestCase::expectUserDeprecation*() methods

16 of 16 new or added lines in 1 file covered. (100.0%)

664 of 681 relevant lines covered (97.5%)

143.08 hits per line

Relevant lines Covered
Build:
Build:
681 RELEVANT LINES 664 COVERED LINES
143.08 HITS PER LINE
Source Files on feature/3.x/new-expectuserdeprecation-polyfill-trait
  • Tree
  • List 38
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line

Recent builds

Builds Branch Commit Type Ran Committer Via Coverage
10745357966 feature/3.x/new-expectuserdeprecation-polyfill-trait PHPUnit 11 | ExpectUserDeprecationtrait: polyfill the TestCase::expectUserDeprecation*() methods PHPUnit 11.0.0 introduces the new `TestCase::expectUserDeprecationMessage()` and `TestCase::expectUserDeprecationMessageMatches()` methods. These me... Pull #200 06 Sep 2024 09:17PM UTC jrfnl github
97.5
10745242967 feature/3.x/new-expectuserdeprecation-polyfill-trait Merge 01cfa57d7 into d6537e896 Pull #200 06 Sep 2024 09:07PM UTC web-flow github
97.5
10745220418 feature/3.x/new-expectuserdeprecation-polyfill-trait PHPUnit 11 | ExpectUserDeprecationtrait: polyfill the TestCase::expectUserDeprecation*() methods PHPUnit 11.0.0 introduces the new `TestCase::expectUserDeprecationMessage()` and `TestCase::expectUserDeprecationMessageMatches()` methods. These me... push 06 Sep 2024 09:05PM UTC jrfnl github
97.5
See All Builds (666)
  • Repo on GitHub
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

© 2025 Coveralls, Inc