public function testsaveAndOthers() { error_reporting(E_ERROR | E_PARSE); //unset and reconnect Db to resolve mysqli fetch exeception global $db; unset($db->database); $db->checkConnection(); $inboundEmail = new InboundEmail(); $inboundEmail->name = 'test'; $inboundEmail->group_id = 1; $inboundEmail->status = 'Active'; $inboundEmail->email_user = '******'; $inboundEmail->email_password = '******'; $inboundEmail->mailbox = 'mailbox1,mailbox2,mailbox3'; $inboundEmail->save(); //test for record ID to verify that record is saved $this->assertTrue(isset($inboundEmail->id)); $this->assertEquals(36, strlen($inboundEmail->id)); //test getCorrectMessageNoForPop3 method $this->getCorrectMessageNoForPop3($inboundEmail->id); //test retrieve method $this->retrieve($inboundEmail->id); //test retrieveByGroupId method $this->retrieveByGroupId($inboundEmail->group_id); //test retrieveAllByGroupId method $this->retrieveAllByGroupId($inboundEmail->group_id); //test retrieveAllByGroupIdWithGroupAccounts method $this->retrieveAllByGroupIdWithGroupAccounts($inboundEmail->group_id); //test getSingularRelatedId method $this->getSingularRelatedId(); //test renameFolder method $this->renameFolder($inboundEmail->id); //test search method $this->search($inboundEmail->id); //test saveMailBoxFolders method $this->saveMailBoxFolders($inboundEmail->id); //test saveMailBoxValueOfInboundEmail method $this->saveMailBoxValueOfInboundEmail($inboundEmail->id); //test mark_deleted method $this->mark_deleted($inboundEmail->id); //test hardDelete method $this->hardDelete($inboundEmail->id); }
public function setUp() { global $current_user, $currentModule; $mod_strings = return_module_language($GLOBALS['current_language'], "Contacts"); $current_user = SugarTestUserUtilities::createAnonymousUser(); $this->outbound_id = uniqid(); $time = date('Y-m-d H:i:s'); $ib = new InboundEmail(); $ib->is_personal = 1; $ib->name = "Test"; $ib->port = 3309; $ib->mailbox = 'empty'; $ib->created_by = $current_user->id; $ib->email_password = "******"; $ib->protocol = 'IMAP'; $stored_options['outbound_email'] = $this->outbound_id; $ib->stored_options = base64_encode(serialize($stored_options)); $ib->save(); $this->ib = $ib; }
if ($_REQUEST['leaveMessagesOnMailServer'] == "1") { $stored_options['leaveMessagesOnMailServer'] = 1; } else { $stored_options['leaveMessagesOnMailServer'] = 0; } } $focus->stored_options = base64_encode(serialize($stored_options)); $GLOBALS['log']->info('----->InboundEmail now saving self'); //////////////////////////////////////////////////////////////////////////////// //// SEND US TO SAVE DESTINATION //////////////////////////////////////////////////////////////////////////////// //When an admin is creating an IE account we do not want their private team to be added //or they may be included in a round robin assignment. $previousTeamAccessCheck = isset($GLOBALS['sugar_config']['disable_team_access_check']) ? $GLOBALS['sugar_config']['disable_team_access_check'] : null; $GLOBALS['sugar_config']['disable_team_access_check'] = TRUE; $focus->save(); //Reset the value so no other saves are affected. $GLOBALS['sugar_config']['disable_team_access_check'] = $previousTeamAccessCheck; //Sync any changes within the IE account that need to be synced with the Sugar Folder. //Need to do this post save so the correct team/teamset id is generated correctly. $monitor_fields = array('name', 'status'); //Only sync IE accounts with a group folder. Need to sync new records as team set assignment is processed //after save. if (!empty($focus->groupfolder_id)) { foreach ($monitor_fields as $singleField) { //Check if the value is being changed during save. if ($focus->fetched_row[$singleField] != $focus->{$singleField}) { syncSugarFoldersWithBeanChanges($singleField, $focus); } } }
function _createInboundAccount() { global $inbound_account_id, $current_user; $stored_options = array(); $stored_options['from_name'] = "UnitTest"; $stored_options['from_addr'] = "*****@*****.**"; $stored_options['reply_to_name'] = "UnitTest"; $stored_options['reply_to_addr'] = "*****@*****.**"; $stored_options['only_since'] = false; $stored_options['filter_domain'] = ""; $stored_options['trashFolder'] = "INBOX.Trash"; $stored_options['leaveMessagesOnMailServer'] = 1; $useSsl = false; $focus = new InboundEmail(); $focus->name = "Ajay Sales Personal Unittest"; $focus->email_user = "******"; $focus->email_password = "******"; $focus->server_url = "mail.sugarcrm.com"; $focus->protocol = "imap"; $focus->mailbox = "INBOX"; $focus->port = "143"; $optimum = $focus->findOptimumSettings($useSsl); $focus->service = $optimum['serial']; $focus->is_personal = 1; $focus->status = "Active"; $focus->mailbox_type = 'pick'; $focus->group_id = $current_user->id; $teamId = User::getPrivateTeam($current_user->id); $focus->team_id = $teamId; $focus->team_set_id = $focus->getTeamSetIdForTeams($teamId); $focus->stored_options = base64_encode(serialize($stored_options)); $inbound_account_id = $focus->save(); }