t465: test(form-manager): improve Form_Manager test coverage to ≥60%#566
Conversation
- Add test_security_checks_dies_for_non_ajax_request: covers the wp_die(0) path in security_checks() when HTTP_X_REQUESTED_WITH is absent (non-AJAX request). Uses wp_die_handler filter to intercept WPDieException instead of process termination. - Add test_security_checks_passes_for_valid_ajax_request: covers the pass-through path when AJAX context + valid form + capable user. - Add test_default_bulk_action_handler_sends_error_when_process_fails: covers the wp_send_json_error() path in default_bulk_action_handler() when process_bulk_action() returns WP_Error (nonexistent model). Coverage: 56.25% → 62.50% methods, 79.06% → 81.23% lines (≥60% target met) Tests: 40 → 43, Assertions: 89 → 94 Closes #559
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 22 minutes and 6 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔨 Build Complete - Ready for Testing!📦 Download Build Artifact (Recommended)Download the zip build, upload to WordPress and test:
🌐 Test in WordPress Playground (Very Experimental)Click the link below to instantly test this PR in your browser - no installation needed! Login credentials: |
|
Performance Test Results Performance test results for 49ab9df are in 🛎️! URL:
|
Summary
Form_Managertest_security_checks_dies_for_non_ajax_request: covers thewp_die(0)path insecurity_checks()whenHTTP_X_REQUESTED_WITHis absenttest_security_checks_passes_for_valid_ajax_request: covers the pass-through path insecurity_checks()with valid AJAX context, registered form, and capable usertest_default_bulk_action_handler_sends_error_when_process_fails: covers thewp_send_json_error()path indefault_bulk_action_handler()whenprocess_bulk_action()returnsWP_Error(nonexistent model)Coverage Results
Note on remaining uncovered methods
display_form_unavailable(),display_form(), andhandle_form()all terminate with baredie/exit(notwp_die()), making them untestable without process isolation. These are documented in the test file comments.Runtime Testing
unit-testedOK (43 tests, 94 assertions)Closes #559