mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-01 11:14:36 +00:00
Bail on update_user_meta() when $object_id is non-numeric.
Adds unit test. Props jacklenox, wonderboymusic. Fixes #28315. git-svn-id: https://develop.svn.wordpress.org/trunk@29339 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -627,4 +627,18 @@ class Tests_User extends WP_UnitTestCase {
|
||||
// If this test fails, it will error out for calling the to_array() method on a non-object.
|
||||
$this->assertInstanceOf( 'WP_Error', wp_update_user( array( 'ID' => $user_id ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 28315
|
||||
*/
|
||||
function test_user_meta_error() {
|
||||
$this->factory->user->create( array( 'user_email' => 'taco@burrito.com' ) );
|
||||
$id = $this->factory->user->create( array( 'user_email' => 'taco@burrito.com' ) );
|
||||
|
||||
$this->assertWPError( $id );
|
||||
@update_user_meta( $id, 'key', 'value' );
|
||||
|
||||
$metas = array_keys( get_user_meta( 1 ) );
|
||||
$this->assertNotContains( 'key', $metas );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user