Repository navigation
Tests: Use assertWPError() in REST users controller tests - #14561
shail-mehta wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The replacements preserve existing test behavior and coverage, with no identified issues.
No open issues 🎉
What changed in this PR
This test-only PR standardizes REST users controller validation tests on WordPress’s dedicated error assertion.
Changes:
- Replaces four
assertInstanceOf( 'WP_Error', … )calls withassertWPError(). - Preserves all existing error-code checks.
| File | Description |
|---|---|
| tests/phpunit/tests/rest-api/rest-users-controller.php | Uses assertWPError() in four user-update validation tests. |
Review effort: Balanced
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
lancewillett
left a comment
There was a problem hiding this comment.
Reviewed with the unit-tests audit: the inherited assertWPError() helper delegates to the same type assertion, preserving the existing error-code checks and custom messages.
The affected class passed in three randomized single-site and three randomized multisite runs (seeds 14557, 14561, and 14568); every changed test executed. PHPCS passed, CI is green, and Copilot reviewed this head without findings.
AI review · gpt-6
|
PR #14561 landed in https://core.trac.wordpress.org/changeset/64643 |
Use the dedicated assertion helper for expected `WP_Error` results, preserving the existing test behavior and assertion messages. Developed in: #14561 Props shailu25. See #65819. git-svn-id: https://develop.svn.wordpress.org/trunk@64643 602fd350-edb4-49c9-b593-d223f7449a82
Use the dedicated assertion helper for expected `WP_Error` results, preserving the existing test behavior and assertion messages. Developed in: WordPress/wordpress-develop#14561 Props shailu25. See #65819. Built from https://develop.svn.wordpress.org/trunk@64643 git-svn-id: http://core.svn.wordpress.org/trunk@63793 1a063a9b-81f0-0310-95a4-ce76da25c4cd
What
Trac ticket: #65819
Replaces generic
assertInstanceOf( 'WP_Error', … )assertions intests/phpunit/tests/rest-api/rest-users-controller.phpwith WordPress’s dedicatedassertWPError()assertion.Retains the existing error code checks.
Test-only change.
Why
Dedicated assertion methods improve failure reporting by including the
WP_Errorcode and message automatically.How
assertInstanceOf( 'WP_Error', … )calls forassertWPError()in user update validation coverageTesting instructions
Use of AI Tools