Set the list cache.
public setCache ( Horde_Kolab_Storage_List_Cache $cache ) | ||
$cache | Horde_Kolab_Storage_List_Cache | The reference to the cache that should reveive any updates. |
/** * Constructor. * * @param Horde_Kolab_Storage_List_Query_List_Cache_Synchronization $sync The synchronization handler.. * @param Horde_Kolab_Storage_List_Cache $cache The list cache. */ public function __construct(Horde_Kolab_Storage_List_Query_List_Cache_Synchronization $sync, Horde_Kolab_Storage_List_Cache $cache) { $this->_sync = $sync; $this->_list_cache = $cache; $this->_sync->setCache($cache); }
public function testSetDefaultResetPreviousDefault() { $namespace = new Horde_Kolab_Storage_Folder_Namespace_Fixed('test'); $driver = $this->getMock('Horde_Kolab_Storage_Driver'); $driver->expects($this->exactly(2))->method('setAnnotation')->with($this->logicalOr('INBOX/Foo', 'INBOX/Bar'), Horde_Kolab_Storage_List_Query_List_Base::ANNOTATION_FOLDER_TYPE, $this->logicalOr('event.default', 'event')); $cache = $this->getMock('Horde_Kolab_Storage_List_Cache', array(), array(), '', false, false); $cache->expects($this->exactly(2))->method('hasNamespace')->will($this->returnValue(true)); $cache->expects($this->once())->method('getNamespace')->will($this->returnValue(serialize($namespace))); $cache->expects($this->once())->method('getFolders')->will($this->returnValue(array('INBOX/Foo', 'INBOX/Bar'))); $cache->expects($this->once())->method('getFolderTypes')->will($this->returnValue(array('INBOX/Foo' => 'event', 'INBOX/Bar' => 'event.default'))); $cache->expects($this->once())->method('store')->with(array('INBOX/Foo', 'INBOX/Bar'), array('INBOX/Foo' => 'event.default', 'INBOX/Bar' => 'event')); $list = new Horde_Kolab_Storage_List_Query_List_Cache_Synchronization($driver, new Horde_Kolab_Storage_Folder_Types(), new Horde_Kolab_Storage_List_Query_List_Defaults_Bail()); $list->setCache($cache); $list->setDefault(array('folder' => 'INBOX/Foo', 'namespace' => 'personal', 'type' => 'event'), 'INBOX/Bar'); }