/** * 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); } }
/** * try to get a message from imap server (with complete body, attachments, etc) * * @see 0006300: add unique message-id header to new messages (for message-id check) */ public function testGetMessage() { $message = $this->_sendMessage(); // get complete message $message = $this->_json->getMessage($message['id']); // check $this->assertTrue(isset($message['headers']) && $message['headers']['message-id']); $this->assertContains('@' . $this->_mailDomain, $message['headers']['message-id']); $this->assertGreaterThan(0, preg_match('/aaaaaä/', $message['body'])); // delete message on imap server and check if correct exception is thrown when trying to get it $this->_imap->selectFolder('INBOX'); $this->_imap->removeMessage($message['messageuid']); Tinebase_Core::getCache()->clean(); $this->setExpectedException('Felamimail_Exception_IMAPMessageNotFound'); $message = $this->_json->getMessage($message['id']); }