public function testLRUCleaning() { $depSettings = Deprecation::dump_settings(); Deprecation::restore_settings(array('level' => false, 'version' => false, 'moduleVersions' => false)); $cache = new ConfigTest_Config_LRU(); for ($i = 0; $i < Config_LRU::SIZE; $i++) { $cache->set($i, $i); } $this->assertEquals(Config_LRU::SIZE, count($cache->indexing)); $cache->clean(); $this->assertEquals(0, count($cache->indexing), 'Clean clears all items'); $this->assertFalse($cache->get(1), 'Clean clears all items'); $cache->set(1, 1, array('Foo')); $this->assertEquals(1, count($cache->indexing)); $cache->clean('Foo'); $this->assertEquals(0, count($cache->indexing), 'Clean items with matching tag'); $this->assertFalse($cache->get(1), 'Clean items with matching tag'); $cache->set(1, 1, array('Foo', 'Bar')); $this->assertEquals(1, count($cache->indexing)); $cache->clean('Bar'); $this->assertEquals(0, count($cache->indexing), 'Clean items with any single matching tag'); $this->assertFalse($cache->get(1), 'Clean items with any single matching tag'); Deprecation::restore_settings($depSettings); }
public function testLRUCleaning() { $cache = new ConfigTest_Config_LRU(); for ($i = 0; $i < Config_LRU::SIZE; $i++) { $cache->set($i, $i); } $this->assertEquals(Config_LRU::SIZE, count($cache->indexing)); $cache->clean(); $this->assertEquals(0, count($cache->indexing), 'Clean clears all items'); $this->assertFalse($cache->get(1), 'Clean clears all items'); $cache->set(1, 1, array('Foo')); $this->assertEquals(1, count($cache->indexing)); $cache->clean('Foo'); $this->assertEquals(0, count($cache->indexing), 'Clean items with matching tag'); $this->assertFalse($cache->get(1), 'Clean items with matching tag'); $cache->set(1, 1, array('Foo', 'Bar')); $this->assertEquals(1, count($cache->indexing)); $cache->clean('Bar'); $this->assertEquals(0, count($cache->indexing), 'Clean items with any single matching tag'); $this->assertFalse($cache->get(1), 'Clean items with any single matching tag'); }