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/oembed/wpOembed.php

    r51568 r60253  
    1212    public $pre_oembed_result_filtered = false;
    1313
     14    /**
     15     * ID of the user.
     16     *
     17     * @var int
     18     */
     19    public static $user_id;
     20
     21    /**
     22     * Set up the shared fixture.
     23     *
     24     * @param WP_UnitTest_Factory $factory Factory instance.
     25     */
     26    public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
     27        self::$user_id = $factory->user->create();
     28    }
     29
    1430    public function set_up() {
    1531        parent::set_up();
     
    97113     */
    98114    public function test_wp_filter_pre_oembed_result_multisite_sub_samesub() {
    99         $user_id = self::factory()->user->create();
     115        $user_id = self::$user_id;
    100116
    101117        $blog_id = self::factory()->blog->create(
     
    126142     */
    127143    public function test_wp_filter_pre_oembed_result_multisite_sub_othersub() {
    128         $user_id = self::factory()->user->create();
     144        $user_id = self::$user_id;
    129145
    130146        $blog_id = self::factory()->blog->create(
     
    165181        $post_id   = self::factory()->post->create();
    166182        $permalink = get_permalink( $post_id );
    167         $user_id   = self::factory()->user->create();
     183        $user_id   = self::$user_id;
    168184        $blog_id   = self::factory()->blog->create(
    169185            array(
     
    190206     */
    191207    public function test_wp_filter_pre_oembed_result_multisite_preserves_switched_state() {
    192         $user_id = self::factory()->user->create();
     208        $user_id = self::$user_id;
    193209
    194210        $blog_id = self::factory()->blog->create( array( 'user_id' => $user_id ) );
     
    221237        $current_blog_id = get_current_blog_id();
    222238
    223         $user_id = self::factory()->user->create();
     239        $user_id = self::$user_id;
    224240        $blog_id = self::factory()->blog->create(
    225241            array(
Note: See TracChangeset for help on using the changeset viewer.