Skip to content

Tests: Improve unit test coverage for WP_Sitemaps_Users - #14166

Open
huzaifaalmesbah wants to merge 1 commit into
WordPress:trunkfrom
huzaifaalmesbah:tests/sitemaps-users
Open

huzaifaalmesbah wants to merge 1 commit into
WordPress:trunkfrom
huzaifaalmesbah:tests/sitemaps-users

Conversation

@huzaifaalmesbah

Copy link
Copy Markdown
Member

Description

Expands the WP_Sitemaps_Users tests, which only covered two get_url_list() cases. The new tests cover pagination of the URL list, authors of public custom post types, users without published posts, the wp_sitemaps_users_pre_url_list, wp_sitemaps_users_entry and wp_sitemaps_users_query_args filters (arguments received and return value used), and get_max_num_pages(), which had no coverage, including its wp_sitemaps_users_pre_max_num_pages short-circuit. Expected URLs are asserted as literal strings.

Follows the sitemaps coverage added in r63770 and r64085.

This is a test-only change; no production code is modified.

Testing Instructions

  1. Run the tests on single site:
    npm run test:php -- --filter 'wpSitemapsUsers'
  2. Run them on multisite:
    npm run test:php -- --filter 'wpSitemapsUsers' -c tests/phpunit/multisite.xml
  3. Run them in random order:
    npm run test:php -- --filter 'wpSitemapsUsers' --order-by=random
  4. Run the whole group to confirm nothing else is affected:
    npm run test:php -- --group sitemaps
  5. Run PHPCS on the test file:
    node ./tools/local-env/scripts/docker.js run --rm php ./vendor/bin/phpcs tests/phpunit/tests/sitemaps/wpSitemapsUsers.php

Trac ticket: https://core.trac.wordpress.org/ticket/65819

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Brainstorming edge-case scenarios and drafting test boilerplate; test architecture, assertions, and local PHPUnit verification were written and validated by me.

@github-actions

Copy link
Copy Markdown

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 props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props huzaifaalmesbah.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

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.

1 participant