Skip to content

Tests: Cover allowed_tags() - #15316

Open
devmuhib009 wants to merge 1 commit into
WordPress:trunkfrom
devmuhib009:tests/65819-cover-allowed-tags
Open

devmuhib009 wants to merge 1 commit into
WordPress:trunkfrom
devmuhib009:tests/65819-cover-allowed-tags

Conversation

@devmuhib009

Copy link
Copy Markdown
Member

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

This PR adds unit tests for allowed_tags() covering:

  • Default HTML entity-encoded allowed tags output from $allowedtags
  • Custom allowed tags and attributes formatting
  • Empty $allowedtags handling

@github-actions

github-actions Bot commented Nov 1, 2026

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 devmuhib.

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the added PHPUnit coverage of WordPress’s allowed_tags() function.

No open issues 🎉

What changed in this PR

Adds PHPUnit coverage for WordPress’s allowed_tags() function, supporting Trac ticket #65819 without changing production code.

Changes:

  • Verifies entity-encoded output for default allowed tags.
  • Tests custom tag and attribute formatting, plus empty allowed tags.
  • Saves and restores $allowedtags around each test to preserve global state.
File Description
tests/​phpunit/​tests/​general/​allowedTags.php Adds three tests for default, custom, and empty allowed tags, with global-state cleanup.

Review effort: Balanced

@huzaifaalmesbah huzaifaalmesbah left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Nice coverage for allowed_tags(), including the custom and empty cases. LGTM.

AI Review: Opus 5.5

@lancewillett
lancewillett requested a review from dmsnell November 1, 2026 16:29
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.

3 participants