cache =& $this->init_cache(); } function tearDown() { parent::tearDown(); wp_cache_flush(); } function &init_cache() { $cache = new WP_Object_cache(); return $cache; } function test_miss() { $this->assertEquals(NULL, $this->cache->get(rand_str())); } function test_add_get() { $key = rand_str(); $val = rand_str(); $this->cache->add($key, $val); $this->assertEquals($val, $this->cache->get($key)); } function test_flush() { $key = rand_str(); $val = rand_str(); $this->cache->add($key, $val); // item is visible to both cache objects $this->assertEquals($val, $this->cache->get($key)); $this->cache->flush(); $this->assertEquals(NULL, $this->cache->get($key)); } } ?>