Skip to content
This repository has been archived by the owner on Apr 4, 2020. It is now read-only.

Unit Tests: Post Meta - Invalid Meta ID should be set to a non-numeric value instead of -1 #6

Open
kjbenk opened this issue Feb 23, 2016 · 0 comments

Comments

@kjbenk
Copy link
Contributor

kjbenk commented Feb 23, 2016

Currently in the Post Meta unit test class the invalid meta id check will change the value of the meta_id to -1 which does not perform the action I think you want it to.

When you pass a value of -1 for the meta_id to the get_metadata_by_mid()* function it will then covert it to 1 from the function absint()**.

An example of this is here: https://github.com/WP-API/wp-api-meta-endpoints/blob/master/tests/test-rest-meta-posts-controller.php#L938.

I think we should instead use a string for the invalid meta_id since it will throw and error no matter what at this line https://github.com/WordPress/WordPress/blob/571e14f897e92c6d330e89d4560f02fa7a958509/wp-includes/meta.php#L570.

References:

** https://github.com/WordPress/WordPress/blob/571e14f897e92c6d330e89d4560f02fa7a958509/wp-includes/meta.php#L556-L595
*** https://github.com/WordPress/WordPress/blob/master/wp-includes/functions.php#L3604-L3614

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant