Changeset 1275 in tests
- Timestamp:
- 04/28/2013 12:20:34 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/cache.php
r1139 r1275 276 276 $this->assertEquals( $val2, $this->cache->get( $key, 'global-cache-test' ) ); 277 277 } 278 279 function test_wp_cache_init() { 280 $new_blank_cache_object = new WP_Object_Cache(); 281 wp_cache_init(); 282 283 global $wp_object_cache; 284 $this->assertEquals( $new_blank_cache_object, $wp_object_cache ); 285 } 286 287 function test_wp_cache_replace() { 288 $key = 'my-key'; 289 $val1 = 'first-val'; 290 $val2 = 'second-val'; 291 292 $fake_key = 'my-fake-key'; 293 294 // Save the first value to cache and verify 295 wp_cache_set( $key, $val1 ); 296 $this->assertEquals( wp_cache_get( $key ), $val1 ); 297 298 // Replace the value and verify 299 wp_cache_replace( $key, $val2 ); 300 $this->assertEquals( wp_cache_get( $key ), $val2 ); 301 302 // Non-existant key should fail 303 $this->assertFalse( wp_cache_replace( $fake_key, $val1 ) ); 304 305 // Make sure $fake_key is not stored 306 $this->assertFalse( wp_cache_get( $fake_key ) ); 307 } 278 308 }
Note: See TracChangeset
for help on using the changeset viewer.