Skip to content

Tests: Add unit test coverage for wp_register(). - #14821

Open
rejaulalomkhan wants to merge 1 commit into
WordPress:trunkfrom
rejaulalomkhan:tests/wp-register
Open

rejaulalomkhan wants to merge 1 commit into
WordPress:trunkfrom
rejaulalomkhan:tests/wp-register

Conversation

@rejaulalomkhan

Copy link
Copy Markdown

Description

Adds unit tests for wp_register(), which had no test coverage.

The tests cover:

  • The registration link when registration is enabled, and an empty result when it is disabled.
  • The Site Admin link for a logged-in user who can read, and an empty result for a logged-in user without it.
  • Default, custom and empty $before/$after wrappers.
  • Escaping of the registration URL.
  • Echo (default) and return modes, and the register filter's argument and result.

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

Testing Instructions

  1. npm run test:php -- --filter Tests_General_WpRegister
  2. npm run test:php -- -c tests/phpunit/multisite.xml --filter Tests_General_WpRegister
  3. npm run test:php -- --group general

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: Drafting the tests and running the checks. I reviewed the changes, ran the tests locally, and take responsibility for them.


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

Covers the registration link when registration is enabled or disabled, the admin link for logged-in users with and without the read capability, the before and after wrappers, URL escaping, echo and return modes, and the register filter.

See #65819.
@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.

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

Props rejaulalomkhan.

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


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

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