/** No necessary with ExpressoMail public function testUpdateMessageCache() { $message = $this->_sendMessage(); $inbox = $this->_getFolder('INBOX'); // update message cache and check result $result = $this->_json->updateMessageCache($inbox['id'], 30); if ($result['cache_status'] == Expressomail_Model_Folder::CACHE_STATUS_COMPLETE) { $this->assertEquals($result['imap_totalcount'], $result['cache_totalcount'], 'totalcounts should be equal'); } else if ($result['cache_status'] == Expressomail_Model_Folder::CACHE_STATUS_INCOMPLETE) { $this->assertNotEquals(0, $result['cache_job_actions_est']); } } /** * test folder status */ public function testGetFolderStatus() { $filter = $this->_getFolderFilter(); $result = $this->_json->searchFolders($filter); $this->assertGreaterThan(1, $result['totalcount']); $teste = array(); foreach ($result['results'] as $folder) { $this->_json->updateMessageCache($folder['id'], 30); $teste[] = $folder['id']; } $message = $this->_sendMessage(); $status = $this->_json->getFolderStatus(array(array('field' => 'id', 'operator' => 'in', 'value' => $teste))); $this->assertEquals($this->_account->sent_folder, $status[0]['globalname']); }
/** * test folder status of deleted folder * * @see 0007134: getFolderStatus should ignore non-existent folders */ public function testGetFolderStatusOfDeletedFolder() { $this->testCreateFolders(); // remove one of the created folders $removedFolder = $this->_createdFolders[0]; $this->_imap->removeFolder(Felamimail_Model_Folder::encodeFolderName($removedFolder)); $status = $this->_json->getFolderStatus(array(array('field' => 'account_id', 'operator' => 'equals', 'value' => $this->_account->getId()))); $this->assertGreaterThan(2, count($status), 'Expected more than 2 folders that need an update: ' . print_r($status, TRUE)); foreach ($status as $folder) { if ($folder['globalname'] == $removedFolder) { $this->fail('removed folder should not appear in status array!'); } } }
/** * test folder status */ public function testGetFolderStatus() { $filter = $this->_getFolderFilter(); $result = $this->_json->searchFolders($filter); $this->assertGreaterThan(1, $result['totalcount']); $expectedFolders = array('INBOX', $this->_testFolderName, $this->_account->trash_folder, $this->_account->sent_folder); foreach ($result['results'] as $folder) { $this->_json->updateMessageCache($folder['id'], 30); } $message = $this->_sendMessage(); $status = $this->_json->getFolderStatus(array(array('field' => 'account_id', 'operator' => 'equals', 'value' => $this->_account->getId()))); $this->assertEquals(1, count($status)); $this->assertEquals($this->_account->sent_folder, $status[0]['localname']); }