Skip to content

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

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

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

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