Repository navigation
Tests: Use assertNotSame() for admin bar profile URL comparisons. - #14853
shail-mehta wants to merge 1 commit into
Conversation
Part of #64895: these comparisons are URL strings, so strict inequality is appropriate.
There was a problem hiding this comment.
🟢 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 withassertNotSame(). - Leave all other assertions unchanged.
| File | Description |
|---|---|
tests/phpunit/tests/adminbar.php |
Use strict inequality for two profile URL comparisons. |
Review effort: Balanced
|
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: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
lancewillett
left a comment
There was a problem hiding this comment.
The changed comparisons use profile URL strings, and the surrounding assertions still verify the admin bar destinations. The multisite run exercised the changed cases.
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
|
PR #14853 landed in https://core.trac.wordpress.org/changeset/64781 |
Use `assertNotSame()` for profile URL comparisons in multisite admin bar tests. Preserve the checks that users without a role on the current site receive links to the appropriate profile screen. Developed in: #14853 Props shailu25. See #64895. git-svn-id: https://develop.svn.wordpress.org/trunk@64781 602fd350-edb4-49c9-b593-d223f7449a82
Use `assertNotSame()` for profile URL comparisons in multisite admin bar tests. Preserve the checks that users without a role on the current site receive links to the appropriate profile screen. Developed in: WordPress/wordpress-develop#14853 Props shailu25. See #64895. Built from https://develop.svn.wordpress.org/trunk@64781 git-svn-id: http://core.svn.wordpress.org/trunk@63931 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Part of: #64895
What
Replaces the remaining
assertNotEquals()calls intests/phpunit/tests/adminbar.phpwithassertNotSame()for profile URL comparisons.Updated methods:
test_admin_bar_contains_correct_links_for_users_with_no_role():assertNotEquals→assertNotSametest_admin_bar_contains_correct_links_for_users_with_no_role_on_network():assertNotEquals→assertNotSameWhy
These comparisons are URL strings (
get_admin_url()/user_admin_url()vsadmin_url()), soassertNotSame()is appropriate. Same approach as [r63632] / [r64079].How
assertNotEquals()toassertNotSame()Testing instructions
npm run test:php -- --filter Tests_AdminBarnpm run test:php -- --group ms-required --filter Tests_AdminBarUse of AI tools
Cursor