[wp-trac] [WordPress Trac] #38323: Reconsider $object_subtype handling in `register_meta()`
WordPress Trac
noreply at wordpress.org
Thu May 31 15:59:26 UTC 2018
#38323: Reconsider $object_subtype handling in `register_meta()`
-------------------------------------------------+-------------------------
Reporter: flixos90 | Owner: flixos90
Type: enhancement | Status: assigned
Priority: normal | Milestone: 5.0
Component: Options, Meta APIs | Version:
Severity: normal | Resolution:
Keywords: has-patch needs-unit-tests needs- | Focuses: rest-api
dev-note |
-------------------------------------------------+-------------------------
Comment (by flixos90):
Thanks a lot for writing all these tests @tharsheblows!
I reviewed and made a few tweaks in [attachment:38323.10.diff]:
* Always return 'comment' as subtype for comments in
`get_object_subtype()`, as we decided to not use comment subtypes at this
point.
* Add ticket annotations to tests.
* Re-add
`test_register_meta_with_term_object_type_populates_wp_meta_keys()` test
that was unnecessarily removed.
* Remove some duplicate test code.
* Simplify tests for `register_meta()` and make them more comprehensive by
using data providers.
* Remove some unnecessary cleanup code from some tests.
* Add further tests, particularly for other meta registration functions
and subtypes.
* Remove duplicate tests for the wrapper functions. It is an unnecessary
maintenance burden to have the same tests run twice, and to verify the
wrapper functions work correctly, we only need to ensure that
`register_meta()` / `unregister_meta_key()` are called correctly by them.
* Improve post meta test setup by only creating the necessary posts and
user once.
* Fix array item alignments in REST post meta tests.
This appears to be in a solid state and very close to commit. I'm going to
have a closer look at the REST API tests soon, as I didn't get to those
yet.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38323#comment:61>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list