Changeset 35732
- Timestamp:
- 11/23/2015 06:39:20 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/user.php
r35631 r35732 532 532 533 533 /** 534 * @ticket 28435 535 */ 536 function test_wp_update_user_should_not_change_password_when_passed_WP_User_instance() { 537 $testuserid = 1; 538 $user = get_userdata( $testuserid ); 539 $pwd_before = $user->user_pass; 540 wp_update_user( $user ); 541 542 // Reload the data 543 $pwd_after = get_userdata( $testuserid )->user_pass; 544 $this->assertEquals( $pwd_before, $pwd_after ); 545 } 546 547 /** 534 548 * @ticket 28315 535 549 */ … … 686 700 public function test_validate_username_invalid() { 687 701 $this->assertFalse( validate_username( '@#&99sd' ) ); 702 } 703 704 /** 705 * @ticket 29880 706 */ 707 public function test_wp_insert_user_should_not_wipe_existing_password() { 708 $user_details = array( 709 'user_login' => rand_str(), 710 'user_pass' => 'password', 711 'user_email' => rand_str() . '@example.com', 712 ); 713 714 $user_id = wp_insert_user( $user_details ); 715 $this->assertEquals( $user_id, email_exists( $user_details['user_email'] ) ); 716 717 // Check that providing an empty password doesn't remove a user's password. 718 $user_details['ID'] = $user_id; 719 $user_details['user_pass'] = ''; 720 721 $user_id = wp_insert_user( $user_details ); 722 $user = WP_User::get_data_by( 'id', $user_id ); 723 $this->assertNotEmpty( $user->user_pass ); 688 724 } 689 725 … … 1009 1045 } 1010 1046 1011 /**1012 * @ticket 284351013 */1014 function test_wp_update_user_no_change_pwd() {1015 $testuserid = 1;1016 $user = get_userdata( $testuserid );1017 $pwd_before = $user->user_pass;1018 wp_update_user( $user );1019 1020 // Reload the data1021 $pwd_after = get_userdata( $testuserid )->user_pass;1022 $this->assertEquals( $pwd_before, $pwd_after );1023 }1024 1025 /**1026 * @ticket 298801027 */1028 function test_wp_insert_user() {1029 $user_details = array(1030 'user_login' => rand_str(),1031 'user_pass' => 'password',1032 'user_email' => rand_str() . '@example.com',1033 );1034 $id1 = wp_insert_user( $user_details );1035 $this->assertEquals( $id1, email_exists( $user_details['user_email'] ) );1036 1037 // Check that providing an empty password doesn't remove a user's password.1038 // See ticket #298801039 $user_details['ID'] = $id1;1040 $user_details['user_pass'] = '';1041 $id1 = wp_insert_user( $user_details );1042 $user = WP_User::get_data_by( 'id', $id1 );1043 $this->assertNotEmpty( $user->user_pass );1044 }1045 1046 1047 }
Note: See TracChangeset
for help on using the changeset viewer.