/** * Set the specified folder as default for its current type. * * @param string $folder The folder name. */ public function setDefault($folder) { $data = $this->folderData($folder); $this->_sync->setDefault($data, $this->getDefault($data['type'])); }
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'); }