WordPress.org

Make WordPress Core

Changeset 448 in tests


Ignore:
Timestamp:
10/06/11 19:11:36 (3 years ago)
Author:
ryan
Message:

Add tests for wp_update_user().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_user.php

    r429 r448  
    266266        $this->assertTrue( $user->has_prop( 'dashed-key' ) ); 
    267267    } 
     268 
     269    function test_update_user() { 
     270        $user_id = $this->_make_user('author', 'test_wp_update_user', 'password', 'test3@test.com'); 
     271        $user = new WP_User( $user_id ); 
     272 
     273        update_user_meta( $user_id, 'description', 'about me' ); 
     274        $this->assertEquals( 'about me', $user->get( 'description' ) ); 
     275 
     276        $user_data = array( 'ID' => $user_id, 'display_name' => 'test user' ); 
     277        wp_update_user( $user_data ); 
     278 
     279        $user = new WP_User( $user_id ); 
     280        $this->assertEquals( 'test user', $user->get( 'display_name' ) ); 
     281 
     282        // Make sure there is no collateral damage to fields not in $user_data 
     283        $this->assertEquals( 'about me', $user->get( 'description' ) ); 
     284    } 
    268285} 
    269286 
Note: See TracChangeset for help on using the changeset viewer.