Make WordPress Core


Ignore:
Timestamp:
12/19/2021 01:42:37 PM (5 years ago)
Author:
johnbillion
Message:

Build/Test Tools: Reduce the use of unnecessary randomness in tests.

This increases the overall reliability of the tests.

Props johnillo

Fixes #37371

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/user.php

    r52352 r52389  
    105105
    106106                // Change and get again.
    107                 $val2 = rand_str();
     107                $val2 = 'baz';
    108108                update_user_option( self::$author_id, $key, $val2 );
    109109                $this->assertSame( $val2, get_user_option( $key, self::$author_id ) );
    … …  
    136136                update_user_meta( self::$author_id, $key, $val );
    137137                // Incorrect key: key still exists.
    138                 delete_user_meta( self::$author_id, $key, rand_str() );
     138                delete_user_meta( self::$author_id, $key, 'foo' );
    139139                $this->assertSame( $val, get_user_meta( self::$author_id, $key, true ) );
    140140                // Correct key: deleted.
    … …  
    150150                // Some values to set.
    151151                $vals = array(
    152                         rand_str() => 'val-' . rand_str(),
    153                         rand_str() => 'val-' . rand_str(),
    154                         rand_str() => 'val-' . rand_str(),
     152                        'key0' => 'val0',
     153                        'key1' => 'val1',
     154                        'key2' => 'val2',
    155155                );
    156156
    … …  
    476476                        'post_author'  => self::$author_id,
    477477                        'post_status'  => 'publish',
    478                         'post_content' => rand_str(),
    479                         'post_title'   => rand_str(),
     478                        'post_content' => 'content',
     479                        'post_title'   => 'title',
    480480                        'post_type'    => 'post',
    481481                );
    … …  
    637637                $id1 = wp_insert_user(
    638638                        array(
    639                                 'user_login' => rand_str(),
     639                                'user_login' => 'taco_burrito',
    640640                                'user_pass'  => 'password',
    641641                                'user_email' => 'taco@burrito.com',
    … …  
    646646                $id2 = wp_insert_user(
    647647                        array(
    648                                 'user_login' => rand_str(),
     648                                'user_login' => 'taco_burrito2',
    649649                                'user_pass'  => 'password',
    650650                                'user_email' => 'taco@burrito.com',
    … …  
    827827        public function test_wp_insert_user_should_not_wipe_existing_password() {
    828828                $user_details = array(
    829                         'user_login' => rand_str(),
     829                        'user_login' => 'jonsnow',
    830830                        'user_pass'  => 'password',
    831                         'user_email' => rand_str() . '@example.com',
     831                        'user_email' => 'jonsnow@example.com',
    832832                );
    833833
Note: See TracChangeset for help on using the changeset viewer.