Make WordPress Core


Ignore:
Timestamp:
05/26/2025 02:34:12 PM (8 months ago)
Author:
johnbillion
Message:

Build/Test Tools: Increase shared user fixtures following switch to bcrypt hashing.

User creation is somewhat more expensive since switching the default password hashing algorithm to bcrypt in 6.8. This speeds up the tests by making more use of shared user fixtures, thus reducing the number of users that are created during tests.

Props peterwilsoncc.

See #63026

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/customize/nav-menu-setting.php

    r54865 r60253  
    1616
    1717    /**
     18     * ID of the administrator user.
     19     *
     20     * @var int
     21     */
     22    public static $administrator_id;
     23
     24    /**
     25     * Set up the shared fixture.
     26     *
     27     * @param WP_UnitTest_Factory $factory Factory instance.
     28     */
     29    public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
     30        self::$administrator_id = $factory->user->create( array( 'role' => 'administrator' ) );
     31    }
     32
     33    /**
    1834     * Set up a test case.
    1935     *
     
    2339        parent::set_up();
    2440        require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
    25         wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
     41        wp_set_current_user( self::$administrator_id );
    2642
    2743        global $wp_customize;
Note: See TracChangeset for help on using the changeset viewer.