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

    r58062 r60253  
    1515     */
    1616    private $long_text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.';
     17
     18    /**
     19     * Editor user ID.
     20     *
     21     * @var int $editor_id
     22     */
     23    public static $editor_id;
     24
     25    public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
     26        self::$editor_id = $factory->user->create( array( 'role' => 'editor' ) );
     27    }
    1728
    1829    /**
     
    465476         * "passing null to non-nullable" deprecation notice.
    466477         */
    467         wp_set_current_user( self::factory()->user->create( array( 'role' => 'editor' ) ) );
     478        wp_set_current_user( self::$editor_id );
    468479
    469480        $args = array(
     
    504515         * "passing null to non-nullable" deprecation notice.
    505516         */
    506         wp_set_current_user( self::factory()->user->create( array( 'role' => 'editor' ) ) );
     517        wp_set_current_user( self::$editor_id );
    507518
    508519        $args = array(
     
    543554         * "passing null to non-nullable" deprecation notice.
    544555         */
    545         wp_set_current_user( self::factory()->user->create( array( 'role' => 'editor' ) ) );
     556        wp_set_current_user( self::$editor_id );
    546557
    547558        $args = array(
Note: See TracChangeset for help on using the changeset viewer.