Changeset 42343 for trunk/tests/phpunit/tests/xmlrpc/wp/editProfile.php
- Timestamp:
- 11/30/2017 11:09:33 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/xmlrpc/wp/editProfile.php
r40417 r42343 13 13 } 14 14 15 function test_subscriber_profile() {16 $subscriber_id = $this->make_user_by_role( 'subscriber' );15 function test_subscriber_profile() { 16 $subscriber_id = $this->make_user_by_role( 'subscriber' ); 17 17 18 $new_data = array(19 'first_name'=> rand_str(),20 'last_name'=> rand_str(),21 'url'=> 'http://www.example.org/subscriber',22 'display_name' => rand_str(),23 'nickname'=> rand_str(),24 'nicename'=> rand_str(),25 'bio' => rand_str(200) 26 );27 $result= $this->myxmlrpcserver->wp_editProfile( array( 1, 'subscriber', 'subscriber', $new_data ) );28 $this->assertNotIXRError( $result );29 $this->assertTrue( $result );18 $new_data = array( 19 'first_name' => rand_str(), 20 'last_name' => rand_str(), 21 'url' => 'http://www.example.org/subscriber', 22 'display_name' => rand_str(), 23 'nickname' => rand_str(), 24 'nicename' => rand_str(), 25 'bio' => rand_str( 200 ), 26 ); 27 $result = $this->myxmlrpcserver->wp_editProfile( array( 1, 'subscriber', 'subscriber', $new_data ) ); 28 $this->assertNotIXRError( $result ); 29 $this->assertTrue( $result ); 30 30 31 // verify that the new values were stored32 $user_data = get_userdata( $subscriber_id );33 $this->assertEquals( $new_data['first_name'], $user_data->first_name );34 $this->assertEquals( $new_data['last_name'], $user_data->last_name );35 $this->assertEquals( $new_data['url'], $user_data->user_url );36 $this->assertEquals( $new_data['display_name'], $user_data->display_name );37 $this->assertEquals( $new_data['nickname'], $user_data->nickname );38 $this->assertEquals( $new_data['nicename'], $user_data->user_nicename );39 $this->assertEquals( $new_data['bio'], $user_data->description );40 }31 // verify that the new values were stored 32 $user_data = get_userdata( $subscriber_id ); 33 $this->assertEquals( $new_data['first_name'], $user_data->first_name ); 34 $this->assertEquals( $new_data['last_name'], $user_data->last_name ); 35 $this->assertEquals( $new_data['url'], $user_data->user_url ); 36 $this->assertEquals( $new_data['display_name'], $user_data->display_name ); 37 $this->assertEquals( $new_data['nickname'], $user_data->nickname ); 38 $this->assertEquals( $new_data['nicename'], $user_data->user_nicename ); 39 $this->assertEquals( $new_data['bio'], $user_data->description ); 40 } 41 41 42 function test_ignore_password_change() {43 $this->make_user_by_role( 'author' );44 $new_pass = 'newpassword';45 $new_data = array( 'password' => $new_pass );42 function test_ignore_password_change() { 43 $this->make_user_by_role( 'author' ); 44 $new_pass = 'newpassword'; 45 $new_data = array( 'password' => $new_pass ); 46 46 47 $result = $this->myxmlrpcserver->wp_editProfile( array( 1, 'author', 'author', $new_data ) );48 $this->assertNotIXRError( $result );49 $this->assertTrue( $result );47 $result = $this->myxmlrpcserver->wp_editProfile( array( 1, 'author', 'author', $new_data ) ); 48 $this->assertNotIXRError( $result ); 49 $this->assertTrue( $result ); 50 50 51 $auth_old = wp_authenticate( 'author', 'author' );52 $auth_new = wp_authenticate( 'author', $new_pass );53 $this->assertInstanceOf( 'WP_User', $auth_old );54 $this->assertWPError( $auth_new );55 }51 $auth_old = wp_authenticate( 'author', 'author' ); 52 $auth_new = wp_authenticate( 'author', $new_pass ); 53 $this->assertInstanceOf( 'WP_User', $auth_old ); 54 $this->assertWPError( $auth_new ); 55 } 56 56 57 function test_ignore_email_change() {58 $editor_id = $this->make_user_by_role( 'editor' );59 $new_email = 'notaneditor@example.com';60 $new_data= array( 'email' => $new_email );57 function test_ignore_email_change() { 58 $editor_id = $this->make_user_by_role( 'editor' ); 59 $new_email = 'notaneditor@example.com'; 60 $new_data = array( 'email' => $new_email ); 61 61 62 $result = $this->myxmlrpcserver->wp_editProfile( array( 1, 'editor', 'editor', $new_data ) );63 $this->assertNotIXRError( $result );64 $this->assertTrue( $result );62 $result = $this->myxmlrpcserver->wp_editProfile( array( 1, 'editor', 'editor', $new_data ) ); 63 $this->assertNotIXRError( $result ); 64 $this->assertTrue( $result ); 65 65 66 $user_data = get_userdata( $editor_id );67 $this->assertNotEquals( $new_email, $user_data->email );68 }66 $user_data = get_userdata( $editor_id ); 67 $this->assertNotEquals( $new_email, $user_data->email ); 68 } 69 69 }
Note: See TracChangeset
for help on using the changeset viewer.