Make WordPress Core


Ignore:
Timestamp:
05/26/2025 02:34:12 PM (5 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-item-setting.php

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