Skip to content

Tests: Use assertWPError() in Customize nav menu item setting tests - #14571

Closed
shail-mehta wants to merge 1 commit into
WordPress:trunkfrom
shail-mehta:tests/65819-assert-wp-error-nav-menu-item-setting
Closed

shail-mehta wants to merge 1 commit into
WordPress:trunkfrom
shail-mehta:tests/65819-assert-wp-error-nav-menu-item-setting

Conversation

@shail-mehta

Copy link
Copy Markdown
Member

What

Trac ticket: #65819

Replaces a generic assertInstanceOf( 'WP_Error', … ) assertion in tests/phpunit/tests/customize/nav-menu-item-setting.php with WordPress’s dedicated assertWPError() assertion.

Retains the existing error code check.

Test-only change.

Why

Dedicated assertion methods improve failure reporting by including the WP_Error code and message automatically.

How

  • Swap one assertInstanceOf( 'WP_Error', … ) call for assertWPError() in invalid URL sanitize coverage

Testing instructions

npm run test:php -- --filter Test_WP_Customize_Nav_Menu_Item_Setting

Use of AI Tools

  • Cursor

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The assertion replacement preserves existing test behavior and coverage, with no unresolved issues.

No open issues 🎉

What changed in this PR

Updates Customize nav menu item tests to use WordPress’s dedicated error assertion.

Changes:

  • Replaces assertInstanceOf( 'WP_Error', … ) with assertWPError().
  • Preserves the invalid_url error-code check; no production code changes.
File Description
tests/​phpunit/​tests/​customize/​nav-menu-item-setting.php Uses the dedicated assertion for invalid URL sanitization.

Review effort: Balanced

@shail-mehta
shail-mehta marked this pull request as ready for review October 20, 2026 17:32
@shail-mehta
shail-mehta marked this pull request as ready for review October 20, 2026 17:32
@github-actions

Copy link
Copy Markdown

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 props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props shailu25.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The assertion replacement preserves existing coverage, with no identified issues.

No open issues 🎉

Review effort: Balanced

@lancewillett lancewillett left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assertion helper preserves the existing behavior and error checks. The affected suites pass locally in randomized single-site and multisite runs; the unit-test audit and PHPCS found no blockers.

AI review · gpt-6

wporg-sync pushed a commit that referenced this pull request Oct 20, 2026
Use `assertWPError()` when checking invalid URLs in the Customizer navigation menu item setting tests. Preserve the `invalid_url` error-code checks.

Developed in: #14571

Props shailu25.
See #65819.


git-svn-id: https://develop.svn.wordpress.org/trunk@64654 602fd350-edb4-49c9-b593-d223f7449a82
@lancewillett

Copy link
Copy Markdown
Member

wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Oct 20, 2026
Use `assertWPError()` when checking invalid URLs in the Customizer navigation menu item setting tests. Preserve the `invalid_url` error-code checks.

Developed in: WordPress/wordpress-develop#14571

Props shailu25.
See #65819.

Built from https://develop.svn.wordpress.org/trunk@64654


git-svn-id: http://core.svn.wordpress.org/trunk@63804 1a063a9b-81f0-0310-95a4-ce76da25c4cd
@shail-mehta
shail-mehta deleted the tests/65819-assert-wp-error-nav-menu-item-setting branch October 21, 2026 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants