| 807 | /** |
| 808 | * @ticket 33800 |
| 809 | */ |
| 810 | function test_delete_user_error_check() { |
| 811 | // Create a test user. |
| 812 | $user_id = $this->factory->user->create( array( |
| 813 | 'user_email' => 'ilovewordpress@example.com', |
| 814 | ) ); |
| 815 | // set data for new user with same email id |
| 816 | $userdata = array( |
| 817 | 'user_login' => 'login_name', |
| 818 | 'user_email' => 'ilovewordpress@example.com', |
| 819 | 'user_pass' => 'mysecretkey' // When creating an user, `user_pass` is expected. |
| 820 | ); |
| 821 | // create new user with email already exists. |
| 822 | $id = wp_insert_user($userdata); |
| 823 | // delete that user but $id is actually WP_Error so wp_delete_user should return false. |
| 824 | $is_deleted = wp_delete_user( $id ); |
| 825 | // check if wp_delete_user returned false |
| 826 | $this->assertFalse( $is_deleted ); |
| 827 | } |