Tests: Add PHPUnit tests for form type classes#333
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 #333 +/- ##
============================================
+ Coverage 23.67% 25.13% +1.45%
Complexity 4410 4410
============================================
Files 291 291
Lines 36940 36916 -24
============================================
+ Hits 8745 9278 +533
+ Misses 28195 27638 -557
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:
|
0ce46b6 to
941b2d0
Compare
941b2d0 to
1ea7407
Compare
Replace `assertTrue(true)` placeholder assertions with meaningful tests: - test-form-attachment.php: Check that admin_footer action is NOT added on wrong screen - test-form-nav-menu.php: Use acf_get_validation_errors() to verify validation behavior - test-form-widget.php: Use acf_get_validation_errors() to verify validation behavior These tests now verify actual behavior rather than just confirming code paths execute.
What
Part of #315.
Adds PHPUnit test coverage for 8 previously untested form type classes that handle field rendering in various WordPress contexts.
Why
Form classes are critical for displaying SCF fields in different WordPress admin screens including:
How
Adding 144 tests across all form types:
test-form-attachment.phpacf_form_attachmenttest-form-comment.phpacf_form_commenttest-form-front.phpacf_form_fronttest-form-gutenberg.phpacf_form_gutenbergtest-form-nav-menu.phpacf_form_nav_menutest-form-taxonomy.phpacf_form_taxonomytest-form-user.phpACF_Form_Usertest-form-widget.phpacf_form_widgetTest coverage includes:
Testing Instructions
Run the test suite:
./vendor/bin/phpunit --filter "Test_Form_Attachment|Test_Form_Comment|Test_Form_Front|Test_Form_Gutenberg|Test_Form_Nav_Menu|Test_Form_Taxonomy|Test_Form_User|Test_Form_Widget"