Repository navigation
feat: add user management execution tests (user queries, user meta, profile lifecycle) - #81
Draft
sarthak-19 wants to merge 2 commits into
Draft
sarthak-19 wants to merge 2 commits into
sarthak-19 wants to merge 2 commits into
Conversation
Add three comments-users tests for issue WordPress#13 covering user queries and multi-value user meta, which existing tests only touch with a single exact meta match: - e-comments-users-008: a member directory page using role__in, a meta filter, numeric ordering by points and pagination totals. String ordering, the AND semantics of role, and a page-sized total all fail. - e-comments-users-009: display-name search. WP_User_Query only does an exact match without * wildcards and searches login and email unless search_columns is set. - e-comments-users-010: follow and unfollow topics stored as one user meta row each. update_user_meta, a unique add and a value-less delete all lose rows; the remaining rows must keep their meta IDs. Suite size goes from 350 to 353 (core plus CLI: 380).
Add three comments-users tests for issue WordPress#13 covering profile updates, the profile_update lifecycle and custom profile fields: - e-comments-users-011: a profile edit that stores display name and website on the user record and first name and phone as meta. Writing display_name as user meta, or meta for a user that does not exist, fails. - e-comments-users-012: an email-change history kept on profile_update, read from $old_user_data; non-email updates and new accounts add no entries. - e-comments-users-013: a custom profile field rendered on both profile screens and saved from both save hooks only when the current user can edit_user that account, with escaped output. The 013 fixture submits the user's unchanged email like the real form, because core's send_confirmation_on_profile_email() reads it. Suite size goes from 353 to 356 (core plus CLI: 383).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds 6 execution tests for #13 in the existing
comments-userscategory.wp-core-v1goes from 350 to 356 (core plus CLI: 383). Dataset and pinned-count changes only; no harness or runtime changes.e-comments-users-008role__in, meta filter, numeric points ranking, three per page with the full totalrolewith an array means every role;meta_valueputs '9' above '300'; a page-sized total is wronge-comments-users-009*wildcards means exact match; withoutsearch_columnsthe login and email also matche-comments-users-010update_user_metaoverwrites every row; a unique add refuses the second topic; a value-less delete wipes all; untouched rows keep their meta IDse-comments-users-011update_user_meta( 'display_name' )writes stray meta and leaves the column alone; meta writes for a missing user leave orphaned rowse-comments-users-012profile_updateget_userdata()already has the new address; non-email updates must not loge-comments-users-013edit_usercheck lets a subscriber edit other accounts;edit_usersblocks a user's own profile; output must be escapedWhy
Issue #13 predates most user coverage. 31 user-related tests already exist: roles and caps (
e-roles-caps-*), login and registration hooks (e-auth-*), basic user create/meta (e-comments-users-001,002,006) and WP-CLI user workflows (e-cli-users-*). This PR covers what's still missing: complex user queries, multi-value user meta, user-table fields vs meta, the profile update lifecycle, and custom profile fields. The "Knowledge Tests" section can't be implemented, since that track was removed in #48.Points for review
wp-core, or land first, whichever you prefer.comments-usersrather than a newuserscategory, so the category mapping doesn't change. I can split them out if you'd rather have a separate category.README.md,test_execution_dataset.pyandtest_wp_cli_shell.py. Whichever merges second needs a one-line rebase.send_confirmation_on_profile_email()reads$_POST['email']onpersonal_options_update. Like the real profile form, the fixture submits the target user's unchanged email. It also carries a validupdate-user_<id>nonce, so solutions that callcheck_admin_referer()still pass.Verification
ruff check python: passedmypy python: no issuespytest python -q: 288 passed, 71 skippedwp-bench run --check-reference-solution(all 356 core tests, 6 workers, SQLite runtime on WordPress 7.1): 356/356 passedwp-bench run --check-exploits --test-id <6 new tests>onreset_per_test: 0/6 exploitablemeta_value_numwithoffset$wpdbLIKEget_users()withfields => 'ids'wp_update_user()withmeta_inputsend_email_change_emailfiltercheck_admin_referer()python datasets/export_dataset.py: 383 rows (356 core + 27 CLI)git diff --check: cleanCommits are split by area: query and meta tests first (350 to 353), then lifecycle and profile tests (353 to 356). Each commit passes the dataset tests on its own.
Refs #13