Skip to content

Tests: Document value comparisons in post count, attachment count, and interactivity tests - #14709

Open
devmuhib009 wants to merge 1 commit into
WordPress:trunkfrom
devmuhib009:tests/64895-document-value-comparisons
Open

devmuhib009 wants to merge 1 commit into
WordPress:trunkfrom
devmuhib009:tests/64895-document-value-comparisons

Conversation

@devmuhib009

Copy link
Copy Markdown
Member

What

Documents intentional assertEquals() comparisons by value in tests/phpunit/tests/post/wpCountPosts.php, tests/phpunit/tests/post/wpCountAttachments.php, and tests/phpunit/tests/interactivity-api/wpInteractivityAPI-wp-html.php.

Why

Per maintainer guidance on Trac #64895, remaining assertEquals() calls in the test suite that compare objects or object-bearing structures across separately constructed instances should retain assertEquals() and document the intentional comparison by value:

// Keep assertEquals() because the objects are intentionally compared by value.

How

  • In tests/phpunit/tests/post/wpCountPosts.php:
    • Lines 100 and 183: Documented object comparisons for new stdClass() and stored counts objects.
    • Line 163: Documented array containing the filtered counts object passed to the wp_count_posts filter.
  • In tests/phpunit/tests/post/wpCountAttachments.php:
    • Line 198: Documented array containing the filtered counts object passed to the wp_count_attachments filter.
    • Line 228: Documented object comparison for the image/jpeg count object.
  • In tests/phpunit/tests/interactivity-api/wpInteractivityAPI-wp-html.php:
    • Line 781: Documented object comparison for json_decode() state marker object.

Trac ticket: https://core.trac.wordpress.org/ticket/64895

…d interactivity tests

Documents intentional `assertEquals()` comparisons by value in `wpCountPosts.php`, `wpCountAttachments.php`, and `wpInteractivityAPI-wp-html.php`.

Follow-up to #64895.
@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.

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

Props devmuhib.

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


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@huzaifaalmesbah huzaifaalmesbah 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.

Thanks! The comments match the guidance on #64895. LGTM.

AI Review: Opus 5.5

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.

2 participants