mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-06 23:58:03 +00:00
After [29339] and [29341], add more unit tests and less ambiguous type-checking before bailing in meta-related functions that expect a numeric value for $object_id.
Props SergeyBiryukov. Fixes #28315. git-svn-id: https://develop.svn.wordpress.org/trunk@29421 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -236,4 +236,24 @@ class Tests_Meta extends WP_UnitTestCase {
|
||||
|
||||
$this->assertEquals( wp_list_pluck( $posts, 'post_title' ), wp_list_pluck( $posts2, 'post_title' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 28315
|
||||
*/
|
||||
function test_non_numeric_object_id() {
|
||||
$this->assertFalse( add_metadata( 'user', array( 1 ), 'meta_key', 'meta_value' ) );
|
||||
$this->assertFalse( update_metadata( 'user', array( 1 ), 'meta_key', 'meta_new_value' ) );
|
||||
$this->assertFalse( delete_metadata( 'user', array( 1 ), 'meta_key' ) );
|
||||
$this->assertFalse( get_metadata( 'user', array( 1 ) ) );
|
||||
$this->assertFalse( metadata_exists( 'user', array( 1 ), 'meta_key' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 28315
|
||||
*/
|
||||
function test_non_numeric_meta_id() {
|
||||
$this->assertFalse( get_metadata_by_mid( 'user', array( 1 ) ) );
|
||||
$this->assertFalse( update_metadata_by_mid( 'user', array( 1 ), 'meta_new_value' ) );
|
||||
$this->assertFalse( delete_metadata_by_mid( 'user', array( 1 ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user