Make WordPress Core


Ignore:
Timestamp:
08/09/2024 06:29:47 PM (19 months ago)
Author:
flixos90
Message:

Build/Test Tools: Avoid using wp_delete_user() in PHPUnit tests unless explicitly acknowledging or ignoring Multisite.

wp_delete_user() does not actually delete the entire user when using WordPress Multisite. Therefore tests should typically use the test helper method to fully delete the user, unless explicitly ignoring Multisite or testing the wp_delete_user() function while taking Multisite behavior into account.

Fixes #61851.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/link/getDashboardUrl.php

    r50454 r58876  
    1313
    1414    public static function wpTearDownAfterClass() {
    15         if ( is_multisite() ) {
    16             wpmu_delete_user( self::$user_id );
    17         } else {
    18             wp_delete_user( self::$user_id );
    19         }
     15        self::delete_user( self::$user_id );
    2016    }
    2117
Note: See TracChangeset for help on using the changeset viewer.