Skip to content

Tests: Add disclaimer for wp_kses_decode_entities() coverage - #15111

Closed
shail-mehta wants to merge 1 commit into
WordPress:trunkfrom
shail-mehta:65819/tests-wp-kses-decode-entities-disclaimer
Closed

shail-mehta wants to merge 1 commit into
WordPress:trunkfrom
shail-mehta:65819/tests-wp-kses-decode-entities-disclaimer

Conversation

@shail-mehta

Copy link
Copy Markdown
Member

What

Trac ticket: #65819

Follow-up to #14665.

Adds a disclaimer to the wp_kses_decode_entities() tests.

Why

Add a clear test caveat that this helper should not be used from new code, and to prefer WP_HTML_Decoder::decode_attribute().

How

In tests/phpunit/tests/kses/wpKsesDecodeEntities.php:

  • Add a file-level disclaimer preferring WP_HTML_Decoder::decode_attribute()
  • Document that these tests only cover historical behavior (numeric entities decoded; named entities left unchanged)

Test-only; no production code changes. Deprecation / caller refactor left for a separate follow-up.

Testing Instructions

  1. npm run test:php -- --filter Tests_Kses_wpKsesDecodeEntities
  2. npm run test:php -- --filter Tests_Kses_wpKsesDecodeEntities -c tests/phpunit/multisite.xml
  3. npm run test:php -- --filter Tests_Kses_wpKsesDecodeEntities --order-by=random
  4. npm run test:php -- --group kses

Use of AI Tools

  • Cursor

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 remain for this documentation-only clarification of legacy decoding behavior and the recommended alternative for new code.

No open issues 🎉

What changed in this PR

Adds a documentation-only caveat to the wp_kses_decode_entities() tests introduced in #14665, clarifying that they preserve historical behavior rather than recommend the helper for new code.

Changes:

  • Recommends WP_HTML_Decoder::decode_attribute() for new code.
  • Explains that the legacy helper decodes numeric entities but leaves named entities unchanged.
  • Changes no test logic or production code.
File Description
tests/​phpunit/​tests/​kses/​wpKsesDecodeEntities.php Adds a file-level disclaimer describing legacy behavior and the preferred decoder.

Review effort: Balanced

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.

2 participants