public function testExpiredCleanup() { $this->assertTrue($this->_instance->clean()); $this->assertTrue($this->_instance->save('BLAH', 'foo', array('TAG1', 'TAG2'), 1)); $this->assertTrue($this->_instance->save('BLAH', 'bar', array('TAG1', 'TAG3'), 1)); $this->assertEquals(array('foo', 'bar'), $this->_instance->getIdsMatchingAnyTags(array('TAG1', 'TAG2', 'TAG3'))); // sleep(2); $this->_instance->___expire('foo'); $this->_instance->___expire('bar'); $this->_instance->clean(Zend_Cache::CLEANING_MODE_OLD); $this->assertEquals(array(), $this->_instance->getIdsMatchingAnyTags(array('TAG1', 'TAG2', 'TAG3'))); $this->assertEquals(array(), $this->_instance->getTags()); }
/** * This method will return an empty array when constructor failed. * * {@inheritdoc} */ public function getTags() { $result = array(); if ($this->works) { $result = parent::getTags(); } return $result; }