Build/Test Tools: Ensure strict assertion - #13451
Open
3kori wants to merge 5 commits into
Open
Conversation
|
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
self-requested a review
September 9, 2026 13:31
lancewillett
approved these changes
Sep 9, 2026
mukeshpanchal27
left a comment
Member
There was a problem hiding this comment.
Thanks @3kori for the PR!
Use multiline comment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace
assertEqualswithassertSameinTest_WP_Customize_Nav_Menu_Item_Setting::test_value_type_post_typeandTest_WP_Customize_Nav_Menu_Item_Setting::test_value_type_taxanomy.Converted the
$expectedvalue to an integer to account for the integer normalization performed bypopulate_value()when it is called inWP_Customize_Nav_Menu_Item_Setting::value().For the rest of the
assertEquals, I kept them as is for the reasons below:The
$expected_sanitized['object_id']is an integer while$nav_menu_item->object_idis a string returned from post meta bywp_setup_nav_menu_item(), so this assertion cannot be converted toassertSamewithout resolving the type mismatch.The
$expected_sanitized['menu_item_parent']is an integer while$nav_menu_item->menu_item_parentis a string returned from post meta bywp_setup_nav_menu_item(), so this assertion cannot be converted toassertSamewithout resolving the type mismatch.The
$post_value[object_id']is an integer while$updated_item->object_idis a string returned from post meta bywp_setup_nav_menu_item(), so this assertion cannot be converted toassertSamewithout resolving the type mismatch.The
$post_value[object_id']is an integer while$last_item->object_idis a string returned from post meta bywp_setup_nav_menu_item(), so this assertion cannot be converted toassertSamewithout resolving the type mismatch.The
(object) $termand$menu_objectare objects being compared by value, so this assertion should remainassertEquals()rather than requiring identical object instances withassertSame().Kept
assertEqualsbecauseraw_instanceis a newly created cast from the input array, so the test intentionally compares the objects by value rather than requiring the same object instance.Trac ticket: #64895
Use of AI Tools
AI assistance: Yes
Tool(s): ChatGPT
Model(s): GPT-5.6
Used for: To track down how values are transformed through
sanitize,wp_set_up_nav_menu_itemandpopulate_valueto determine which assertions should be converted or retained. The final code changes and decisions were reviewed and made by me.This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.