Skip to content

Tests: Use assertNotSame() for user meta query login comparison. - #14855

Closed
shail-mehta wants to merge 1 commit into
WordPress:trunkfrom
shail-mehta:tests/assert-not-same-meta-64895
Closed

shail-mehta wants to merge 1 commit into
WordPress:trunkfrom
shail-mehta:tests/assert-not-same-meta-64895

Conversation

@shail-mehta

Copy link
Copy Markdown
Member

Part of: #64895

What

Replaces the remaining assertNotEquals() call in tests/phpunit/tests/meta.php with assertNotSame() for the user login comparison.

Updated method:

  • test_user_metadata_not_exists(): assertNotEquals → assertNotSame for user_login

Why

#64895 asks for strict assertions when both sides share a type. These are user_login strings, so assertNotSame() is appropriate.

How

  • Convert the author vs found-user login inequality check from assertNotEquals() to assertNotSame()
  • Leave other assertions in the file unchanged

Testing instructions

  1. Start the local WordPress develop environment.
  2. Run: npm run test:php -- --filter test_user_metadata_not_exists

Use of AI tools

Cursor

Part of #64895: user_login values are strings, so strict inequality is appropriate.

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

Both operands are login strings, so the strict assertion preserves the intended check without introducing a correctness issue.

No open issues 🎉

What changed in this PR

Updates the user metadata query test to use a strict comparison for login strings, aligning with WordPress ticket #64895.

Changes:

  • Replaces assertNotEquals() with assertNotSame() in test_user_metadata_not_exists().
  • Leaves all other assertions unchanged.
File Description
tests/​phpunit/​tests/​meta.php Uses strict inequality for the author and found-user login comparison.

Review effort: Balanced

@shail-mehta
shail-mehta marked this pull request as ready for review October 26, 2026 16:42
@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 shailu25.

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.

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 narrow assertion change is appropriate for string login values and preserves the test’s intended check.

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.

Both operands are user-login strings. The strict comparison preserves the check that the meta query excludes the fixture author.

Unit-tests audit completed. Combined randomized runs passed: single-site 497 tests / 1,609 assertions; multisite 521 tests / 1,694 assertions, with one skip in each run. PHPCS and CI passed. Copilot has no open findings.

AI review · gpt-6

@lancewillett

Copy link
Copy Markdown
Member

wporg-sync pushed a commit that referenced this pull request Oct 27, 2026
Use `assertNotSame()` when checking that a `NOT EXISTS` user meta query excludes the fixture author.

Developed in: #14855

Props shailu25.
See #64895.


git-svn-id: https://develop.svn.wordpress.org/trunk@64783 602fd350-edb4-49c9-b593-d223f7449a82
wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Oct 27, 2026
Use `assertNotSame()` when checking that a `NOT EXISTS` user meta query excludes the fixture author.

Developed in: WordPress/wordpress-develop#14855

Props shailu25.
See #64895.

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


git-svn-id: http://core.svn.wordpress.org/trunk@63933 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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