Changeset 38763 for trunk/tests/phpunit/tests/cache.php
- Timestamp:
- 10/09/2016 01:29:04 AM (9 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/cache.php (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/cache.php
r37954 r38763 28 28 29 29 function test_miss() { 30 $this->assertEquals( NULL, $this->cache->get(rand_str()));30 $this->assertEquals( NULL, $this->cache->get( 'test_miss' ) ); 31 31 } 32 32 33 33 function test_add_get() { 34 $key = rand_str();35 $val = rand_str();34 $key = __FUNCTION__; 35 $val = 'val'; 36 36 37 37 $this->cache->add($key, $val); … … 40 40 41 41 function test_add_get_0() { 42 $key = rand_str();42 $key = __FUNCTION__; 43 43 $val = 0; 44 44 … … 49 49 50 50 function test_add_get_null() { 51 $key = rand_str();51 $key = __FUNCTION__; 52 52 $val = null; 53 53 … … 58 58 59 59 function test_add() { 60 $key = rand_str();61 $val1 = rand_str();62 $val2 = rand_str();60 $key = __FUNCTION__; 61 $val1 = 'val1'; 62 $val2 = 'val2'; 63 63 64 64 // add $key to the cache … … 71 71 72 72 function test_replace() { 73 $key = rand_str();74 $val = rand_str();75 $val2 = rand_str();73 $key = __FUNCTION__; 74 $val = 'val1'; 75 $val2 = 'val2'; 76 76 77 77 // memcached rejects replace() if the key does not exist … … 85 85 86 86 function test_set() { 87 $key = rand_str();88 $val1 = rand_str();89 $val2 = rand_str();87 $key = __FUNCTION__; 88 $val1 = 'val1'; 89 $val2 = 'val2'; 90 90 91 91 // memcached accepts set() if the key does not exist … … 103 103 return; 104 104 105 $key = rand_str();106 $val = rand_str();105 $key = __FUNCTION__; 106 $val = 'val'; 107 107 108 108 $this->cache->add($key, $val); … … 116 116 // Make sure objects are cloned going to and from the cache 117 117 function test_object_refs() { 118 $key = rand_str();118 $key = __FUNCTION__ . '_1'; 119 119 $object_a = new stdClass; 120 120 $object_a->foo = 'alpha'; … … 126 126 $this->assertEquals( 'bravo', $object_a->foo ); 127 127 128 $key = rand_str();128 $key = __FUNCTION__ . '_2'; 129 129 $object_a = new stdClass; 130 130 $object_a->foo = 'alpha'; … … 138 138 139 139 function test_incr() { 140 $key = rand_str();140 $key = __FUNCTION__; 141 141 142 142 $this->assertFalse( $this->cache->incr( $key ) ); … … 151 151 152 152 function test_wp_cache_incr() { 153 $key = rand_str();153 $key = __FUNCTION__; 154 154 155 155 $this->assertFalse( wp_cache_incr( $key ) ); … … 164 164 165 165 function test_decr() { 166 $key = rand_str();166 $key = __FUNCTION__; 167 167 168 168 $this->assertFalse( $this->cache->decr( $key ) ); … … 184 184 */ 185 185 function test_wp_cache_decr() { 186 $key = rand_str();186 $key = __FUNCTION__; 187 187 188 188 $this->assertFalse( wp_cache_decr( $key ) ); … … 201 201 202 202 function test_delete() { 203 $key = rand_str();204 $val = rand_str();203 $key = __FUNCTION__; 204 $val = 'val'; 205 205 206 206 // Verify set … … 216 216 217 217 function test_wp_cache_delete() { 218 $key = rand_str();219 $val = rand_str();218 $key = __FUNCTION__; 219 $val = 'val'; 220 220 221 221 // Verify set … … 238 238 return; 239 239 240 $key = rand_str();241 $val = rand_str();242 $val2 = rand_str();240 $key = __FUNCTION__; 241 $val = 'val1'; 242 $val2 = 'val2'; 243 243 244 244 if ( ! is_multisite() ) {
Note: See TracChangeset
for help on using the changeset viewer.