Make WordPress Core

Changeset 1176 in tests


Ignore:
Timestamp:
12/27/2012 03:34:43 PM (12 years ago)
Author:
nacin
Message:

Test that wp_update_user() does not fatal error when called with a non-existent user ID. It should instead return WP_Error. see #22858.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/user.php

    r1097 r1176  
    594594        $this->assertEquals( 1, $counts[$user_id_b] );
    595595    }
     596
     597    /**
     598     * @ticket 22858
     599     */
     600    function test_wp_update_user_on_nonexistent_users() {
     601        $user_id = 1;
     602        // Find me a non-existent user ID.
     603        while ( get_userdata( $user_id ) )
     604            ++$user_id;
     605
     606        // If this test fails, it will error out for calling the to_array() method on a non-object.
     607        $this->assertInstanceOf( 'WP_Error', wp_update_user( array( 'ID' => $user_id ) ) );
     608    }
    596609}
Note: See TracChangeset for help on using the changeset viewer.