Make WordPress Core


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

    r57242 r60253  
    2828
    2929    /**
     30     * Second admin user ID.
     31     *
     32     * @var int
     33     */
     34    protected static $other_admin_user_id;
     35
     36    /**
    3037     * Subscriber user ID.
    3138     *
     
    4754     */
    4855    public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
    49         self::$subscriber_user_id = $factory->user->create( array( 'role' => 'subscriber' ) );
    50         self::$admin_user_id      = $factory->user->create( array( 'role' => 'administrator' ) );
     56        self::$subscriber_user_id  = $factory->user->create( array( 'role' => 'subscriber' ) );
     57        self::$admin_user_id       = $factory->user->create( array( 'role' => 'administrator' ) );
     58        self::$other_admin_user_id = $factory->user->create( array( 'role' => 'administrator' ) );
    5159    }
    5260
     
    154162    public function test_constructor_deferred_changeset_uuid() {
    155163        wp_set_current_user( self::$admin_user_id );
    156         $other_admin_user_id = self::factory()->user->create( array( 'role' => 'admin' ) );
     164        $other_admin_user_id = self::$other_admin_user_id;
    157165
    158166        $data = array(
     
    12551263    public function test_save_changeset_post_without_kses_corrupting_json() {
    12561264        global $wp_customize;
    1257         $lesser_admin_user_id = self::factory()->user->create( array( 'role' => 'administrator' ) );
     1265        $lesser_admin_user_id = self::$other_admin_user_id;
    12581266
    12591267        $uuid         = wp_generate_uuid4();
     
    15001508        add_theme_support( 'custom-background' );
    15011509        wp_set_current_user( self::$admin_user_id );
    1502         $other_admin_user_id = self::factory()->user->create( array( 'role' => 'administrator' ) );
     1510        $other_admin_user_id = self::$other_admin_user_id;
    15031511
    15041512        $uuid         = wp_generate_uuid4();
     
    17151723        add_theme_support( 'custom-background' );
    17161724        wp_set_current_user( self::$admin_user_id );
    1717         $other_admin_user_id = self::factory()->user->create( array( 'role' => 'administrator' ) );
     1725        $other_admin_user_id = self::$other_admin_user_id;
    17181726
    17191727        $uuid         = wp_generate_uuid4();
     
    18781886            array(
    18791887                'autosave' => true,
    1880                 'user_id'  => self::factory()->user->create( array( 'role' => 'administrator' ) ),
     1888                'user_id'  => self::$other_admin_user_id,
    18811889            )
    18821890        );
     
    30103018     */
    30113019    public function test_return_url() {
    3012         wp_set_current_user( self::factory()->user->create( array( 'role' => 'author' ) ) );
     3020        wp_set_current_user( self::$subscriber_user_id );
    30133021        $this->assertSame( home_url( '/' ), $this->manager->get_return_url() );
    30143022
Note: See TracChangeset for help on using the changeset viewer.