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/control.php

    r55457 r60253  
    1919
    2020    /**
     21     * Shared user ID for the tests.
     22
     23     * @var int
     24     */
     25    public static $user_id = 0;
     26
     27    /**
     28     * Set up shared fixtures.
     29     *
     30     * @param WP_UnitTest_Factory $factory Factory.
     31     */
     32    public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
     33        self::$user_id = $factory->user->create( array( 'role' => 'administrator' ) );
     34    }
     35
     36    /**
    2137     * Set up.
    2238     */
    2339    public function set_up() {
    2440        parent::set_up();
    25         wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
     41        wp_set_current_user( self::$user_id );
    2642        require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
    2743        $GLOBALS['wp_customize'] = new WP_Customize_Manager();
Note: See TracChangeset for help on using the changeset viewer.