Make WordPress Core


Ignore:
Timestamp:
10/09/2016 01:29:04 AM (10 years ago)
Author:
johnbillion
Message:

Build/Test Tools: Continue eliminating randomness in tests.

See [38762]
See #37371

File:
1 edited

Legend:

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

    r37954 r38763  
    2828
    2929        function test_miss() {
    30                 $this->assertEquals(NULL, $this->cache->get(rand_str()));
     30                $this->assertEquals( NULL, $this->cache->get( 'test_miss' ) );
    3131        }
    3232
    3333        function test_add_get() {
    34                 $key = rand_str();
    35                 $val = rand_str();
     34                $key = __FUNCTION__;
     35                $val = 'val';
    3636
    3737                $this->cache->add($key, $val);
    … …  
    4040
    4141        function test_add_get_0() {
    42                 $key = rand_str();
     42                $key = __FUNCTION__;
    4343                $val = 0;
    4444
    … …  
    4949
    5050        function test_add_get_null() {
    51                 $key = rand_str();
     51                $key = __FUNCTION__;
    5252                $val = null;
    5353
    … …  
    5858
    5959        function test_add() {
    60                 $key = rand_str();
    61                 $val1 = rand_str();
    62                 $val2 = rand_str();
     60                $key = __FUNCTION__;
     61                $val1 = 'val1';
     62                $val2 = 'val2';
    6363
    6464                // add $key to the cache
    … …  
    7171
    7272        function test_replace() {
    73                 $key = rand_str();
    74                 $val = rand_str();
    75                 $val2 = rand_str();
     73                $key = __FUNCTION__;
     74                $val = 'val1';
     75                $val2 = 'val2';
    7676
    7777                // memcached rejects replace() if the key does not exist
    … …  
    8585
    8686        function test_set() {
    87                 $key = rand_str();
    88                 $val1 = rand_str();
    89                 $val2 = rand_str();
     87                $key = __FUNCTION__;
     88                $val1 = 'val1';
     89                $val2 = 'val2';
    9090
    9191                // memcached accepts set() if the key does not exist
    … …  
    103103                        return;
    104104
    105                 $key = rand_str();
    106                 $val = rand_str();
     105                $key = __FUNCTION__;
     106                $val = 'val';
    107107
    108108                $this->cache->add($key, $val);
    … …  
    116116        // Make sure objects are cloned going to and from the cache
    117117        function test_object_refs() {
    118                 $key = rand_str();
     118                $key = __FUNCTION__ . '_1';
    119119                $object_a = new stdClass;
    120120                $object_a->foo = 'alpha';
    … …  
    126126                $this->assertEquals( 'bravo', $object_a->foo );
    127127
    128                 $key = rand_str();
     128                $key = __FUNCTION__ . '_2';
    129129                $object_a = new stdClass;
    130130                $object_a->foo = 'alpha';
    … …  
    138138
    139139        function test_incr() {
    140                 $key = rand_str();
     140                $key = __FUNCTION__;
    141141
    142142                $this->assertFalse( $this->cache->incr( $key ) );
    … …  
    151151
    152152        function test_wp_cache_incr() {
    153                 $key = rand_str();
     153                $key = __FUNCTION__;
    154154
    155155                $this->assertFalse( wp_cache_incr( $key ) );
    … …  
    164164
    165165        function test_decr() {
    166                 $key = rand_str();
     166                $key = __FUNCTION__;
    167167
    168168                $this->assertFalse( $this->cache->decr( $key ) );
    … …  
    184184         */
    185185        function test_wp_cache_decr() {
    186                 $key = rand_str();
     186                $key = __FUNCTION__;
    187187
    188188                $this->assertFalse( wp_cache_decr( $key ) );
    … …  
    201201
    202202        function test_delete() {
    203                 $key = rand_str();
    204                 $val = rand_str();
     203                $key = __FUNCTION__;
     204                $val = 'val';
    205205
    206206                // Verify set
    … …  
    216216
    217217        function test_wp_cache_delete() {
    218                 $key = rand_str();
    219                 $val = rand_str();
     218                $key = __FUNCTION__;
     219                $val = 'val';
    220220
    221221                // Verify set
    … …  
    238238                        return;
    239239
    240                 $key = rand_str();
    241                 $val = rand_str();
    242                 $val2 = rand_str();
     240                $key = __FUNCTION__;
     241                $val = 'val1';
     242                $val2 = 'val2';
    243243
    244244                if ( ! is_multisite() ) {
Note: See TracChangeset for help on using the changeset viewer.