#61851 closed enhancement (fixed)
Unit tests should typically not use `wp_delete_user()` to delete users for multisite compatibility
| Reported by: | flixos90 | Owned by: | flixos90 |
|---|---|---|---|
| Priority: | low | Milestone: | 6.7 |
| Component: | Build/Test Tools | Version: | |
| Severity: | minor | Keywords: | has-patch has-unit-tests |
| Cc: | Focuses: | multisite |
Description
Several PHPUnit tests rely on wp_delete_user() to delete temporarily created users. However, when using WordPress Multisite, wpmu_delete_user() needs to be used instead. For this purpose, the WordPress test base class provides a static method delete_user( $user_id ), which abstracts away this detail.
All PHPUnit tests should use this static method instead of wp_delete_user(), unless the test is explicitly excluding multisite or testing a behavior of wp_delete_user() with consideration of how it behaves differently with a multisite network.
Change History (3)
This ticket was mentioned in PR #7175 on WordPress/wordpress-develop by @flixos90.
2 years ago
#1
- Keywords has-patch has-unit-tests added; needs-patch removed
@flixos90 commented on PR #7175:
2 years ago
#3
Committed in https://core.trac.wordpress.org/changeset/58876
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Trac ticket: https://core.trac.wordpress.org/ticket/61851