#61851 closed enhancement (fixed)
Unit tests should typically not use `wp_delete_user()` to delete users for multisite compatibility
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 6.7 | Priority: | low |
| Severity: | minor | Version: | |
| Component: | Build/Test Tools | Keywords: | has-patch has-unit-tests |
| Focuses: | multisite | Cc: |
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.
15 months ago
#1
- Keywords has-patch has-unit-tests added; needs-patch removed
@flixos90 commented on PR #7175:
15 months ago
#3
Committed in https://core.trac.wordpress.org/changeset/58876
Note: See
TracTickets for help on using
tickets.
Trac ticket: https://core.trac.wordpress.org/ticket/61851