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/admin/includesPlugin.php

    r53874 r58876  
    9797
    9898        // Clean up the temporary user.
    99         wp_delete_user( $admin_user );
     99        self::delete_user( $admin_user );
    100100
    101101        // Verify the menu was inserted at the expected position.
     
    205205
    206206        // Clean up the temporary user.
    207         wp_delete_user( $admin_user );
     207        self::delete_user( $admin_user );
    208208
    209209        foreach ( $actual_positions as $test => $actual_position ) {
     
    296296        // Clean up the temporary user.
    297297        wp_set_current_user( $current_user );
    298         wp_delete_user( $admin_user );
     298        self::delete_user( $admin_user );
    299299
    300300        // Verify the menu was inserted at the expected position.
     
    327327        // Clean up the temporary user.
    328328        wp_set_current_user( $current_user );
    329         wp_delete_user( $admin_user );
     329        self::delete_user( $admin_user );
    330330
    331331        // Verify the menu was inserted at the expected position.
     
    356356        // Clean up the temporary user.
    357357        wp_set_current_user( $current_user );
    358         wp_delete_user( $admin_user );
     358        self::delete_user( $admin_user );
    359359
    360360        // Verify the menus were inserted.
Note: See TracChangeset for help on using the changeset viewer.