-
Notifications
You must be signed in to change notification settings - Fork 45
Refactor to extract Abilities base class #264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## trunk #264 +/- ##
==========================================
+ Coverage 8.84% 9.36% +0.52%
+ Complexity 4322 4288 -34
==========================================
Files 265 266 +1
Lines 33404 33159 -245
==========================================
+ Hits 2953 3105 +152
+ Misses 30451 30054 -397
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:
|
|
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. |
What
Refactor Abilities API classes to extract a shared base class and consolidate tests.
Why
Post Type and Taxonomy abilities shared most code and logic, since they map almost 1:1 the
acf_internal_post_typemethods. This will reduce maintenance, simplify tests, and make it easier to add abilities for Field Groups and Options Pages.The base class is heavily tested, with full coverage I wouldn't consider worth in most cases, but apart from leveraging ai tools to create the tests, it serves as a way to "document" the settings and allowed polishing the abilities, as some of them were not correctly marked as read-only.
How
SCF_Internal_Post_Type_Abilitiesbase class with shared CRUD logicSCF_Post_Type_AbilitiesandSCF_Taxonomy_Abilitiesto thin subclasses that simply map to each SCF post type.Testing Instructions
vendor/bin/phpunit --testsuite=secure-custom-fieldsnpm run test:e2e -- abilities-internal-post-types.spec.ts