WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/09/2016 01:11:14 AM (4 years ago)
Author:
johnbillion
Message:

Build/Test Tools: Begin eliminating unnecessary randomness in tests.

Although unlikely, clashes in randomly generated strings could cause unexpected failures. In addition, most randomness is entirely unnecessary, is bad practice, and increases test time (however small it may be).

See #37371

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/option/multisite.php

    r35242 r38762  
    2626
    2727    function test_from_same_site() {
    28         $key = rand_str();
    29         $key2 = rand_str();
    30         $value = rand_str();
    31         $value2 = rand_str();
     28        $key    = __FUNCTION__ . '_1';
     29        $key2   = __FUNCTION__ . '_2';
     30        $value  = __FUNCTION__ . '_val1';
     31        $value2 = __FUNCTION__ . '_val2';
    3232
    3333        $this->assertFalse( get_blog_option( 1, 'doesnotexist' ) );
     
    6363
    6464    function test_from_same_site_with_null_blog_id() {
    65         $key = rand_str();
    66         $key2 = rand_str();
    67         $value = rand_str();
    68         $value2 = rand_str();
     65        $key    = __FUNCTION__ . '_1';
     66        $key2   = __FUNCTION__ . '_2';
     67        $value  = __FUNCTION__ . '_val1';
     68        $value2 = __FUNCTION__ . '_val2';
    6969
    7070        $this->assertFalse( get_blog_option( null, 'doesnotexist' ) );
     
    110110        $this->assertInternalType( 'integer', $blog_id );
    111111
    112         $key = rand_str();
    113         $key2 = rand_str();
    114         $value = rand_str();
    115         $value2 = rand_str();
     112        $key    = __FUNCTION__ . '_key1';
     113        $key2   = __FUNCTION__ . '_key2';
     114        $value  = __FUNCTION__ . '_val1';
     115        $value2 = __FUNCTION__ . '_val2';
    116116
    117117        $this->assertFalse( get_blog_option( $blog_id, 'doesnotexist' ) );
Note: See TracChangeset for help on using the changeset viewer.