Tests: Add PHPUnit tests for AJAX handlers#326
Conversation
|
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. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## trunk #326 +/- ##
============================================
+ Coverage 16.68% 17.04% +0.35%
Complexity 4410 4410
============================================
Files 291 291
Lines 36995 36995
============================================
+ Hits 6173 6306 +133
+ Misses 30822 30689 -133
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Add comprehensive PHPUnit test coverage for AJAX handler security: - ACF_Ajax base class: Nonce verification, request handling - ACF_Ajax_Query: Public endpoint verification, input sanitization - ACF_Ajax_Query_Users: Nonce and capability checks - ACF_Ajax_Check_Screen: Permission verification - ACF_Ajax_Upgrade: Admin capability enforcement - ACF_Ajax_User_Setting: Admin-only access checks - ACF_Ajax_Local_JSON_Diff: Admin access and post type validation - acf_verify_ajax(): Nonce validation function tests - acf_current_user_can_admin(): Capability helper tests 72 new tests covering P0 security areas including: - Nonce verification for all handlers - Capability enforcement per handler requirements - Input sanitization for search parameters - Public vs non-public endpoint registration 🤖 Generated with [Claude Code](https://claude.com/claude-code)
92c5ad9 to
880a8ea
Compare
What
Part of #315.
Adds PHPUnit security test coverage for all AJAX handlers in
includes/ajax/.Why
These tests verify nonce verification, capability enforcement, and input sanitization
How
With the help of Claude, adding 69 tests covering:
ACF_Ajaxbase classACF_Ajax_QueryACF_Ajax_Query_UsersACF_Ajax_Check_ScreenACF_Ajax_UpgradeACF_Ajax_User_SettingACF_Ajax_Local_JSON_DiffTesting Instructions
Run the test suite:
./vendor/bin/phpunit --filter Test_Ajax_Handlers