Skip to content

Tests: Use assertNotSame() for admin bar profile URL comparisons. - #14853

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

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

Conversation

@shail-mehta

@shail-mehta shail-mehta commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

Part of: #64895

What

Replaces the remaining assertNotEquals() calls in tests/phpunit/tests/adminbar.php with assertNotSame() for profile URL comparisons.

Updated methods:

  • test_admin_bar_contains_correct_links_for_users_with_no_role(): assertNotEquals → assertNotSame
  • test_admin_bar_contains_correct_links_for_users_with_no_role_on_network(): assertNotEquals → assertNotSame

Why

These comparisons are URL strings (get_admin_url() / user_admin_url() vs admin_url()), so assertNotSame() is appropriate. Same approach as [r63632] / [r64079].

How

  • Convert the two profile URL inequality checks 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 Tests_AdminBar
  3. For the multisite cases: npm run test:php -- --group ms-required --filter Tests_AdminBar

Use of AI tools

Cursor

Part of #64895: these comparisons are URL 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 comparisons use URL strings, so strict inequality preserves the intended checks without identified correctness issues.

No open issues 🎉

What changed in this PR

This PR updates two admin bar tests to use strict inequality assertions for profile URL strings. No production code changes are included.

Changes:

  • Replace two assertNotEquals() calls with assertNotSame().
  • Leave all other assertions unchanged.
File Description
tests/​phpunit/​tests/​adminbar.php Use strict inequality for two profile URL comparisons.

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