Repository navigation
test: cover the admin bar, active-posts widget and Users list edge paths - #813
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #813 +/- ##
============================================
+ Coverage 97.12% 97.55% +0.43%
+ Complexity 271 269 -2
============================================
Files 30 30
Lines 4375 4372 -3
============================================
+ Hits 4249 4265 +16
+ Misses 126 107 -19
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the 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. |
huzaifaalmesbah
left a comment
There was a problem hiding this comment.
The front-end test and the subscriber markup test read well, and the class-level @covers reasoning checks out. A few of the added rows raise coverage without guarding anything, and some cases sit in tests named for something else; details inline.
AI review: Claude Opus 5.5
|
@noruzzamans This PR isn't linked to an issue. Could you link one first? |
|
Thanks for adding these test edge paths @noruzzamans. A few recommendations following up on the maintainers' review:
|
|
Thanks for the thorough review and recommendations, @huzaifaalmesbah, @i-am-chitti, and @rejaulalomkhan. I've addressed the feedback in 3ad7344:
All linters and PHPStan Level 8 checks pass cleanly. |
… test/admin-surfaces-edge-paths
There was a problem hiding this comment.
Thanks for the rework! I removed each guard in turn to see which tests fail, and most are covered now. Three tests still need a change:
-
test_unparsable_post_room_is_skipped_and_first_post_room_wins
It never reaches the! $parsedcheck, because the valid row comes first and the bad one is skipped as a duplicate. Putting the unparsable row on a second user with no other post room fixes that. -
test_heartbeat_received_returns_empty_without_fragment_request
It passes with both fragment checks removed, because nobody is signed in and the capability check returns first. Signing in a user who can list users fixes that. -
test_heartbeat_received_ignores_unauthorised_user
It catches nothingtest_register_skips_a_user_who_cannot_edit_postsdoesn't already, so it can go.
|
Thanks @josephfusco, addressed all three in 99ba54c:
|
|
Tightened in 5c79e8f: isolated the unparsable room to a dedicated user so it directly guards the |
josephfusco
left a comment
There was a problem hiding this comment.
Thanks for the changes! I removed each guard again and the unparsable room and online count tests now fail without them. The users-list assertion in test_heartbeat_received_returns_empty_without_fragment_request still passes with its fragment check removed, because the nonce check returns first, so that line and its @covers can go. That was my suggestion that didn't work out, not yours. Happy to merge either way.
WP_Test_Presence_Admin_Bar's class-level@coverslist narrows coverage for every test without its own tag, sowp_presence_refresh_screen_token()andwp_presence_get_entry_screen()were already exercised here without being counted.Relates to #550.
Use of AI Tools
AI assistance: Yes
Tool(s): Google Gemini
Model(s): Gemini 3.8 Flash
Used for: Identifying uncovered branches and drafting the test cases; reviewed and verified locally by me.