Make WordPress Core


Ignore:
Timestamp:
08/01/2014 05:09:53 PM (12 years ago)
Author:
wonderboymusic
Message:

Bail on update_user_meta() when $object_id is non-numeric.

Adds unit test.

Props jacklenox, wonderboymusic.
Fixes #28315.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/user.php

    r25440 r29339  
    628628                $this->assertInstanceOf( 'WP_Error', wp_update_user( array( 'ID' => $user_id ) ) );
    629629        }
     630
     631        /**
     632         * @ticket 28315
     633         */
     634        function test_user_meta_error() {
     635                $this->factory->user->create( array( 'user_email' => 'taco@burrito.com' ) );
     636                $id = $this->factory->user->create( array( 'user_email' => 'taco@burrito.com' ) );
     637
     638                $this->assertWPError( $id );
     639                @update_user_meta( $id, 'key', 'value' );
     640
     641                $metas = array_keys( get_user_meta( 1 ) );
     642                $this->assertNotContains( 'key', $metas );
     643        }
    630644}
Note: See TracChangeset for help on using the changeset viewer.