Skip to content
This repository was archived by the owner on Apr 4, 2020. It is now read-only.
This repository was 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

Description

@kjbenk

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions