/** * Tears down the fixture * This method is called after a test is executed. * * @access protected */ protected function tearDown() { if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) { Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Tearing down ...'); } if (count($this->_createdFolders) > 0) { foreach ($this->_createdFolders as $folderName) { //echo "delete $folderName\n"; try { $this->_imap->removeFolder(Felamimail_Model_Folder::encodeFolderName($folderName)); } catch (Zend_Mail_Storage_Exception $zmse) { // already deleted } } Felamimail_Controller_Cache_Folder::getInstance()->clear($this->_account); } if (!empty($this->_foldersToClear)) { foreach ($this->_foldersToClear as $folderName) { // delete test messages from given folders on imap server (search by special header) $this->_imap->selectFolder($folderName); $result = $this->_imap->search(array('HEADER X-Tine20TestMessage jsontest')); //print_r($result); foreach ($result as $messageUid) { $this->_imap->removeMessage($messageUid); } // clear message cache $folder = Felamimail_Controller_Folder::getInstance()->getByBackendAndGlobalName($this->_account->getId(), $folderName); Felamimail_Controller_Cache_Message::getInstance()->clear($folder); } } // sieve cleanup if ($this->_testSieveScriptName !== NULL) { Felamimail_Controller_Sieve::getInstance()->setScriptName($this->_testSieveScriptName); try { Felamimail_Controller_Sieve::getInstance()->deleteScript($this->_account->getId()); } catch (Zend_Mail_Protocol_Exception $zmpe) { // do not delete script if active } Felamimail_Controller_Account::getInstance()->setVacationActive($this->_account, $this->_oldSieveVacationActiveState); if ($this->_oldSieveData !== NULL) { $this->_oldSieveData->save(); } } if ($this->_oldActiveSieveScriptName !== NULL) { Felamimail_Controller_Sieve::getInstance()->setScriptName($this->_oldActiveSieveScriptName); Felamimail_Controller_Sieve::getInstance()->activateScript($this->_account->getId()); } // vfs cleanup foreach ($this->_pathsToDelete as $path) { $webdavRoot = new DAV\ObjectTree(new Tinebase_WebDav_Root()); //echo "delete $path"; $webdavRoot->delete($path); } Tinebase_TransactionManager::getInstance()->rollBack(); }
/** * Tears down the fixture * This method is called after a test is executed. * * @access protected */ protected function tearDown() { if (count($this->_createdFolders) > 0) { foreach ($this->_createdFolders as $folderName) { //echo "delete $folderName\n"; try { $this->_imap->removeFolder(Expressomail_Model_Folder::encodeFolderName($folderName)); } catch (Zend_Mail_Storage_Exception $zmse) { // already deleted } } //No necessary with Expressomail // Expressomail_Controller_Cache_Folder::getInstance()->clear($this->_account); } if (!empty($this->_foldersToClear)) { foreach ($this->_foldersToClear as $folderName) { // delete test messages from given folders on imap server (search by special header) $this->_imap->selectFolder($folderName); $result = $this->_imap->search(array('HEADER X-Tine20TestMessage jsontest')); //print_r($result); foreach ($result as $messageUid) { $this->_imap->removeMessage($messageUid); } // clear message cache $folder = Expressomail_Controller_Folder::getInstance()->getByBackendAndGlobalName($this->_account->getId(), $folderName); //No necessary with Expressomail // Expressomail_Controller_Cache_Message::getInstance()->clear($folder); } } // sieve cleanup if ($this->_testSieveScriptName !== NULL) { Expressomail_Controller_Sieve::getInstance()->setScriptName($this->_testSieveScriptName); try { Expressomail_Controller_Sieve::getInstance()->deleteScript($this->_account->getId()); } catch (Zend_Mail_Protocol_Exception $zmpe) { // do not delete script if active } Expressomail_Controller_Account::getInstance()->setVacationActive($this->_account, $this->_oldSieveVacationActiveState); if ($this->_oldSieveData !== NULL) { $this->_oldSieveData->save(); } } if ($this->_oldActiveSieveScriptName !== NULL) { Expressomail_Controller_Sieve::getInstance()->setScriptName($this->_oldActiveSieveScriptName); Expressomail_Controller_Sieve::getInstance()->activateScript($this->_account->getId()); } // vfs cleanup foreach ($this->_pathsToDelete as $path) { $webdavRoot = new Sabre_DAV_ObjectTree(new Tinebase_WebDav_Root()); //echo "delete $path"; $webdavRoot->delete($path); } }