Introduce WP_UnitTestCase::delete_user()
.
This static method provides a multisite-agnostic way to delete users during automated testing. See #32796. git-svn-id: https://develop.svn.wordpress.org/trunk@32953 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
d0c3281ea8
commit
da5c716009
@ -597,4 +597,17 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase {
|
||||
public function tear_down_wp_mail_globals() {
|
||||
unset( $_SERVER['SERVER_NAME'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Multisite-agnostic way to delete a user from the database.
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
public static function delete_user( $user_id ) {
|
||||
if ( is_multisite() ) {
|
||||
return wpmu_delete_user( $user_id );
|
||||
} else {
|
||||
return wp_delete_user( $user_id );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user