| 519 | * @ticket 33800 |
| 520 | */ |
| 521 | function test_delete_user_error_check() { |
| 522 | // Create a test user. |
| 523 | $user_id = $this->factory->user->create( array( |
| 524 | 'user_email' => 'ilovewordpress@example.com', |
| 525 | ) ); |
| 526 | // set data for new user with same email id |
| 527 | $userdata = array( |
| 528 | 'user_login' => 'login_name', |
| 529 | 'user_email' => 'ilovewordpress@example.com', |
| 530 | 'user_pass' => 'mysecretkey' // When creating an user, `user_pass` is expected. |
| 531 | ); |
| 532 | // create new user with email already exists. |
| 533 | $id = wp_insert_user( $userdata ); |
| 534 | // delete that user but $id is actually WP_Error so wp_delete_user should return false. |
| 535 | $is_deleted = wp_delete_user( $id ); |
| 536 | // check if wp_delete_user returned false |
| 537 | $this->assertFalse( $is_deleted ); |
| 538 | } |
| 539 | |
| 540 | /** |