/** * @covers WANObjectCache::touchCheckKey() * @covers WANObjectCache::resetCheckKey() * @covers WANObjectCache::getCheckKeyTime() */ public function testTouchKeys() { $key = wfRandomString(); $priorTime = microtime(true); usleep(1); $t0 = $this->cache->getCheckKeyTime($key); $this->assertGreaterThanOrEqual($priorTime, $t0, 'Check key auto-created'); $priorTime = microtime(true); usleep(1); $this->cache->touchCheckKey($key); $t1 = $this->cache->getCheckKeyTime($key); $this->assertGreaterThanOrEqual($priorTime, $t1, 'Check key created'); $t2 = $this->cache->getCheckKeyTime($key); $this->assertEquals($t1, $t2, 'Check key time did not change'); usleep(1); $this->cache->touchCheckKey($key); $t3 = $this->cache->getCheckKeyTime($key); $this->assertGreaterThan($t2, $t3, 'Check key time increased'); $t4 = $this->cache->getCheckKeyTime($key); $this->assertEquals($t3, $t4, 'Check key time did not change'); usleep(1); $this->cache->resetCheckKey($key); $t5 = $this->cache->getCheckKeyTime($key); $this->assertGreaterThan($t4, $t5, 'Check key time increased'); $t6 = $this->cache->getCheckKeyTime($key); $this->assertEquals($t5, $t6, 'Check key time did not change'); }