Repository navigation
Tests: Add unit tests for sanitize_category_field() - #14367
shail-mehta wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
Static review found no blocking issues; assertions match the implementation and framework cleanup behavior, though tests were not executed.
No open issues 🎉
What changed in this PR
Adds unit coverage for sanitize_category_field() to WordPress’s category test suite, addressing Trac #65819.
Changes:
- Tests integer conversion and case-insensitive raw contexts.
- Verifies context-specific filters, arguments, and legacy slug filtering.
- Checks escaping output and the escaping functions used.
| File | Description |
|---|---|
| tests/phpunit/tests/category/sanitizeCategoryField.php | Adds tests for field conversion, filtering, and escaping. |
Review effort: Balanced
|
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 Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
lancewillett
left a comment
There was a problem hiding this comment.
Reviewed the tests against the implementation and existing coverage, including the unit-tests audit. No blocking findings. The affected classes passed locally in randomized order on single site (29 tests) and multisite (29 tests); PHPCS and current CI pass.
AI review · gpt-6
Checks field casting, con-specific filters and escaping, including the database slug path. Developed in: #14367 Props shailu25, mukesh27. See #65819. git-svn-id: https://develop.svn.wordpress.org/trunk@64461 602fd350-edb4-49c9-b593-d223f7449a82
|
PR #14367 landed in https://core.trac.wordpress.org/changeset/64461 |
Checks field casting, con-specific filters and escaping, including the database slug path. Developed in: WordPress/wordpress-develop#14367 Props shailu25, mukesh27. See #65819. Built from https://develop.svn.wordpress.org/trunk@64461 git-svn-id: http://core.svn.wordpress.org/trunk@63611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
What
Trac ticket: #65819
Adds unit tests for
sanitize_category_field()intests/phpunit/tests/category/sanitizeCategoryField.php.Why
sanitize_category_field()currently has no unit test coverage.How
Adds
Tests_Category_SanitizeCategoryFieldto test casting integer fields to non-negative integers,rawcontext handling, context-specific filters (edit,db,rss,display,attribute,js, andpre_category_nicename), and context-specific escaping (esc_html(),esc_attr(), andesc_js()).Testing Instructions
npm run test:php -- --filter Tests_Category_SanitizeCategoryFieldUse of AI Tools