Make WordPress Core


Ignore:
Timestamp:
06/26/2015 12:58:29 PM (9 years ago)
Author:
boonebgorges
Message:

Introduce WP_UnitTestCase::delete_user().

This static method provides a multisite-agnostic way to delete users during
automated testing.

See #32796.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/testcase.php

    r32839 r32953  
    598598        unset( $_SERVER['SERVER_NAME'] );
    599599    }
     600
     601    /**
     602     * Multisite-agnostic way to delete a user from the database.
     603     *
     604     * @since 4.3.0
     605     */
     606    public static function delete_user( $user_id ) {
     607        if ( is_multisite() ) {
     608            return wpmu_delete_user( $user_id );
     609        } else {
     610            return wp_delete_user( $user_id );
     611        }
     612    }
    600613}
Note: See TracChangeset for help on using the changeset viewer.