public function testGetNamePlusEmailAddressesForComposePersonModule()
 {
     $contact = SugarTestContactUtilities::createContact();
     $email = new Email();
     $this->assertEquals($GLOBALS['locale']->getLocaleFormattedName($contact->first_name, $contact->last_name, $contact->salutation, $contact->title) . " <{$contact->email1}>", $email->getNamePlusEmailAddressesForCompose('Contacts', array($contact->id)));
     SugarTestContactUtilities::removeAllCreatedContacts();
 }
Example #2
0
 public function tearDown()
 {
     SugarTestAccountUtilities::removeAllCreatedAccounts();
     SugarTestContactUtilities::removeAllCreatedContacts();
     SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
     SugarTestHelper::tearDown();
 }
 public function tearDown()
 {
     SugarTestHelper::tearDown();
     SugarTestAccountUtilities::removeAllCreatedAccounts();
     SugarTestContactUtilities::removeAllCreatedContacts();
     SugarTestLeadUtilities::removeAllCreatedLeads();
 }
 public function tearDown()
 {
     $this->contact->field_defs = $this->defs;
     SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
     unset($GLOBALS['current_user']);
     SugarTestContactUtilities::removeAllCreatedContacts();
 }
 public function tearDown()
 {
     SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
     SugarTestContactUtilities::removeAllCreatedContacts();
     SugarTestContactUtilities::removeCreatedContactsEmailAddresses();
     unset($this->form);
     unset($this->contact1);
 }
Example #6
0
 public function tearDown()
 {
     SugarTestContactUtilities::removeAllCreatedContacts();
     SugarTestAccountUtilities::removeAllCreatedAccounts();
     SugarTestEmailUtilities::removeAllCreatedEmails();
     SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
     unset($GLOBALS['current_user']);
 }
Example #7
0
 public function tearDown()
 {
     $this->relateField->delete($this->df);
     $this->rc->repairAndClearAll(array("rebuildExtensions", "clearVardefs"), array("Contact"), false, false);
     SugarTestAccountUtilities::removeAllCreatedAccounts();
     SugarTestContactUtilities::removeAllCreatedContacts();
     SugarTestHelper::tearDown();
 }
Example #8
0
 public static function tearDownAfterClass()
 {
     unset($_REQUEST['data']);
     unset($_REQUEST['query']);
     SugarTestContactUtilities::removeAllCreatedContacts();
     unset($GLOBALS['beanList']);
     unset($GLOBALS['beanFiles']);
 }
Example #9
0
 public static function tearDownAfterClass()
 {
     SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
     SugarTestContactUtilities::removeAllCreatedContacts();
     SugarTestAccountUtilities::removeAllCreatedAccounts();
     unset($GLOBALS['current_user']);
     $GLOBALS['db']->commit();
 }
Example #10
0
 /**
  * Tears down the fixture, for example, close a network connection.
  * This method is called after a test is executed.
  */
 public function tearDown()
 {
     SugarTestAccountUtilities::removeAllCreatedAccounts();
     SugarTestOpportunityUtilities::removeAllCreatedOpportunities();
     SugarTestContactUtilities::removeAllCreatedContacts();
     parent::tearDown();
     SugarTestHelper::tearDown();
 }
Example #11
0
 public function tearDown()
 {
     SugarTestAccountUtilities::removeAllCreatedAccounts();
     SugarTestContactUtilities::removeAllCreatedContacts();
     parent::tearDown();
     parent::_tearDownTestUser();
     SugarTestHelper::tearDown();
 }
Example #12
0
 public function tearDown()
 {
     SugarTestContactUtilities::removeAllCreatedContacts();
     unset($this->contact);
     unset($GLOBALS['beanFiles'], $GLOBALS['beanList']);
     SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
     unset($GLOBALS['current_user']);
 }
Example #13
0
 public function tearDown()
 {
     SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
     SugarTestContactUtilities::removeAllCreatedContacts();
     SugarTestAccountUtilities::removeAllCreatedAccounts();
     SugarTestTrackerUtility::removeAllTrackerEntries();
     unset($GLOBALS['current_user']);
     unset($GLOBALS['app_strings']);
 }
Example #14
0
 public function tearDown()
 {
     $GLOBALS["db"]->query("DELETE FROM inbound_email WHERE id = '{$this->ie->id}'");
     $GLOBALS["db"]->query("DELETE FROM cases WHERE name = '{$this->ie->casename}'");
     SugarTestAccountUtilities::removeAllCreatedAccounts();
     SugarTestContactUtilities::removeCreatedContactsEmailAddresses();
     SugarTestContactUtilities::removeAllCreatedContacts();
     SugarTestHelper::tearDown();
 }
Example #15
0
 public function testDisplay()
 {
     $view = new ViewVcard();
     $view->bean = SugarTestContactUtilities::createContact();
     $view->module = 'Contacts';
     $view->display();
     SugarTestContactUtilities::removeAllCreatedContacts();
     $this->expectOutputRegex('/BEGIN\\:VCARD/');
 }
Example #16
0
 public function tearDown()
 {
     SugarTestHelper::tearDown();
     SugarTestOpportunityUtilities::removeAllCreatedOpportunities();
     SugarTestEmailUtilities::removeAllCreatedEmails();
     SugarTestContactUtilities::removeAllCreatedContacts();
     SugarTestAccountUtilities::removeAllCreatedAccounts();
     $GLOBALS['app'] = $this->application;
 }
Example #17
0
 protected function tearDown()
 {
     SugarTestContactUtilities::removeAllCreatedContacts();
     SugarTestContactUtilities::removeCreatedContactsEmailAddresses();
     SugarTestContactUtilities::removeCreatedContactsUsersRelationships();
     SugarTestMeetingUtilities::removeAllCreatedMeetings();
     SugarTestMeetingUtilities::removeMeetingContacts();
     SugarTestMeetingUtilities::removeMeetingUsers();
     SugarTestHelper::tearDown();
 }
Example #18
0
 /**
  * Remove anything that was used during this test
  *
  */
 public function tearDown()
 {
     SugarTestContactUtilities::removeAllCreatedContacts();
     SugarTestContactUtilities::removeCreatedContactsUsersRelationships();
     SugarTestMeetingUtilities::removeAllCreatedMeetings();
     SugarTestMeetingUtilities::removeMeetingContacts();
     $this->_meeting = null;
     $this->_contact = null;
     parent::tearDown();
 }
Example #19
0
 /**
  * Remove anything that was used during this test
  *
  */
 public function tearDown()
 {
     $this->_tearDownTestUser();
     $this->_user = null;
     $this->_sessionId = '';
     unset($GLOBALS['beanList']);
     unset($GLOBALS['beanFiles']);
     SugarTestAccountUtilities::removeAllCreatedAccounts();
     SugarTestContactUtilities::removeAllCreatedContacts();
 }
Example #20
0
 /**
  * Remove anything that was used during this test
  *
  */
 public function tearDown()
 {
     parent::tearDown();
     SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
     SugarTestContactUtilities::removeAllCreatedContacts();
     SugarTestContactUtilities::removeCreatedContactsUsersRelationships();
     $this->_contact = null;
     SugarTestMeetingUtilities::removeMeetingContacts();
     unset($GLOBALS['beanList']);
     unset($GLOBALS['beanFiles']);
 }
Example #21
0
 public function testDisplay()
 {
     $view = new ViewVcard();
     $view->bean = SugarTestContactUtilities::createContact();
     $view->module = 'Contacts';
     ob_start();
     $view->display();
     $output = ob_get_contents();
     ob_end_clean();
     SugarTestContactUtilities::removeAllCreatedContacts();
     $this->assertContains('BEGIN:VCARD', $output);
 }
Example #22
0
 public function tearDown()
 {
     foreach (SugarTestContactUtilities::getCreatedContactIds() as $id) {
         $GLOBALS['db']->query("DELETE FROM accounts_contacts WHERE contact_id = '{$id}'");
     }
     SugarTestContactUtilities::removeAllCreatedContacts();
     SugarTestAccountUtilities::removeAllCreatedAccounts();
     SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
     unset($GLOBALS['current_user']);
     unset($GLOBALS['beanList']);
     unset($GLOBALS['beanFiles']);
 }
Example #23
0
 public function tearDown()
 {
     if ($this->_default_max_tabs_set) {
         $GLOBALS['sugar_config']['default_max_tabs'] = $this->_default_max_tabs;
     } else {
         unset($GLOBALS['sugar_config']['default_max_tabs']);
     }
     unset($GLOBALS['beanFiles']);
     unset($GLOBALS['beanList']);
     unset($GLOBALS['current_user']);
     unset($GLOBALS['app_list_strings']);
     unset($GLOBALS['app_strings']);
     unset($GLOBALS['request_string']);
     SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
     SugarTestContactUtilities::removeAllCreatedContacts();
 }
Example #24
0
 public function tearDown()
 {
     return;
     $GLOBALS['current_user'] = $this->saved_current_user;
     if ($this->remove_beans) {
         $this->campaign->mark_deleted($this->campaign->id);
         $this->prospectlist->mark_deleted($this->prospectlist->id);
         SugarTestContactUtilities::removeAllCreatedContacts();
         SugarTestLeadUtilities::removeAllCreatedLeads();
     }
     if ($this->clear_database) {
         $sql = 'DELETE FROM email_marketing WHERE campaign_id = \'' . $this->campaign->id . '\'';
         $GLOBALS['db']->query($sql);
         $sql = 'DELETE FROM emailman WHERE campaign_id = \'' . $this->campaign->id . '\'';
         $GLOBALS['db']->query($sql);
         $sql = 'DELETE FROM campaign_log WHERE campaign_id = \'' . $this->campaign->id . '\'';
         $GLOBALS['db']->query($sql);
         $sql = 'DELETE FROM prospect_lists_prospects WHERE prospect_list_id=\'' . $this->prospectlist->id . '\'';
         $GLOBALS['db']->query($sql);
         $sql = 'DELETE FROM prospect_lists_prospects WHERE prospect_list_id=\'' . $this->prospectlist2->id . '\'';
         $GLOBALS['db']->query($sql);
         $sql = 'DELETE FROM prospect_lists WHERE id = \'' . $this->prospectlist->id . '\'';
         $GLOBALS['db']->query($sql);
         $sql = 'DELETE FROM prospect_lists WHERE id = \'' . $this->prospectlist2->id . '\'';
         $GLOBALS['db']->query($sql);
         $sql = 'DELETE FROM prospect_list_campaigns WHERE campaign_id = \'' . $this->campaign->id . '\'';
         $GLOBALS['db']->query($sql);
         $sql = 'DELETE FROM campaigns WHERE id = \'' . $this->campaign->id . '\'';
         $GLOBALS['db']->query($sql);
     }
 }
 public function tearDown()
 {
     $this->df->deleteField($this->field);
     $account_ids = SugarTestAccountUtilities::getCreatedAccountIds();
     $contact_ids = SugarTestContactUtilities::getCreatedContactIds();
     $GLOBALS['db']->query('DELETE FROM accounts_contacts WHERE contact_id IN (\'' . implode("', '", $contact_ids) . '\') OR  account_id IN (\'' . implode("', '", $account_ids) . '\')');
     SugarTestContactUtilities::removeAllCreatedContacts();
     SugarTestAccountUtilities::removeAllCreatedAccounts();
     SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
     unset($GLOBALS['current_user']);
     unset($GLOBALS['beanFiles']);
     unset($GLOBALS['beanList']);
 }
Example #26
0
 public function tearDown()
 {
     SugarTestContactUtilities::removeCreatedContactsUsersRelationships();
     SugarTestContactUtilities::removeAllCreatedContacts();
     SugarTestMeetingUtilities::removeMeetingContacts();
     SugarTestMeetingUtilities::removeAllCreatedMeetings();
     SugarTestCallUtilities::removeAllCreatedCalls();
     unset($GLOBALS['beanList']);
     unset($GLOBALS['beanFiles']);
     unset($GLOBALS['app_list_strings']);
     unset($GLOBALS['app_strings']);
     unset($GLOBALS['mod_strings']);
     unset($GLOBALS['current_user']);
 }
Example #27
0
 public function testActivityCopy()
 {
     // init
     $lead = SugarTestLeadUtilities::createLead();
     $contact = SugarTestContactUtilities::createContact();
     $meeting = SugarTestMeetingUtilities::createMeeting();
     SugarTestMeetingUtilities::addMeetingParent($meeting->id, $lead->id);
     $relation_id = SugarTestMeetingUtilities::addMeetingLeadRelation($meeting->id, $lead->id);
     $_REQUEST['record'] = $lead->id;
     // refresh the meeting to include parent_id and parent_type
     $meeting_id = $meeting->id;
     $meeting = new Meeting();
     $meeting->retrieve($meeting_id);
     // action: copy meeting from lead to contact
     $convertObj = new TestViewConvertLead();
     $convertObj->copyActivityWrapper($meeting, $contact);
     // 1. the original meeting should still have the same parent_type and parent_id
     $meeting->retrieve($meeting_id);
     $this->assertEquals('Leads', $meeting->parent_type, 'parent_type of the original meeting was changed from Leads to ' . $meeting->parent_type);
     $this->assertEquals($lead->id, $meeting->parent_id, 'parent_id of the original meeting was changed from ' . $lead->id . ' to ' . $meeting->parent_id);
     // 2. a newly created meeting with parent type=Contatcs and parent_id=$contact->id
     $sql = "select id from meetings where parent_id='{$contact->id}' and parent_type= 'Contacts' and deleted=0";
     $result = $GLOBALS['db']->query($sql);
     $row = $GLOBALS['db']->fetchByAssoc($result);
     $this->assertNotNull($row, 'Could not find the newly created meeting with parent_type=Contacts and parent_id=' . $contact->id);
     $new_meeting_id = '';
     if ($row) {
         $new_meeting_id = $row['id'];
     }
     // 3. record should not be deleted from meetings_leads table
     $sql = "select id from meetings_leads where meeting_id='{$meeting->id}' and lead_id='{$lead->id}' and deleted=0";
     $result = $GLOBALS['db']->query($sql);
     $row = $GLOBALS['db']->fetchByAssoc($result);
     $this->assertNotNull($row, "Meeting-Lead relationship was removed.");
     // 4. new meeting record should be added to meetings_contacts table
     $sql = "select id from meetings_contacts where meeting_id='{$new_meeting_id}' and contact_id='{$contact->id}' and deleted=0";
     $result = $GLOBALS['db']->query($sql);
     $row = $GLOBALS['db']->fetchByAssoc($result);
     $this->assertFalse(empty($row), "Meeting-Contact relationship has not been added.");
     // clean up
     unset($_REQUEST['record']);
     $GLOBALS['db']->query("delete from meetings where parent_id='{$contact->id}' and parent_type= 'Contacts'");
     $GLOBALS['db']->query("delete from meetings where parent_id='{$lead->id}' and parent_type= 'Leads'");
     $GLOBALS['db']->query("delete from meetings_contacts where meeting_id='{$new_meeting_id}' and contact_id= '{$contact->id}'");
     SugarTestMeetingUtilities::deleteMeetingLeadRelation($relation_id);
     SugarTestMeetingUtilities::removeMeetingContacts();
     SugarTestMeetingUtilities::removeAllCreatedMeetings();
     SugarTestContactUtilities::removeAllCreatedContacts();
     SugarTestLeadUtilities::removeAllCreatedLeads();
 }
Example #28
0
 /**
  * Removing field, account, contact
  */
 public function tearDown()
 {
     SugarTestContactUtilities::removeAllCreatedContacts();
     SugarTestAccountUtilities::removeAllCreatedAccounts();
     $this->dynamicField->deleteField($this->field);
     SugarTestHelper::tearDown();
 }
 public function testHandlePresetRelationshipsDelete()
 {
     $acc = SugarTestAccountUtilities::createAccount();
     $macc = new MockAccountSugarBean();
     $macc->disable_row_level_security = true;
     $macc->retrieve($acc->id);
     // create an contact
     $contact = SugarTestContactUtilities::createContact();
     // insert a dummy row
     $rel_row_id = create_guid();
     $sql = "INSERT INTO accounts_contacts (id, account_id, contact_id) VALUES ('" . $rel_row_id . "','" . $macc->id . "','" . $contact->id . "')";
     $GLOBALS['db']->query($sql);
     $GLOBALS['db']->commit();
     // set the contact id from the bean.
     $macc->rel_fields_before_value['contact_id'] = $contact->id;
     $new_rel_id = $macc->handle_preset_relationships($contact->id, 'contacts');
     $this->assertEquals($contact->id, $new_rel_id);
     // make sure the relationship exists
     $sql = "SELECT account_id, contact_id from accounts_contacts where account_id = '" . $macc->id . "' AND contact_id = '" . $contact->id . "' and deleted = 0";
     $result = $GLOBALS['db']->query($sql);
     $row = $GLOBALS['db']->fetchByAssoc($result);
     $this->assertFalse($row);
     SugarTestAccountUtilities::removeAllCreatedAccounts();
     SugarTestContactUtilities::removeAllCreatedContacts();
     unset($macc);
 }
 public function tearDown()
 {
     global $current_user;
     SugarTestContactUtilities::removeAllCreatedContacts();
     $GLOBALS['db']->query("DELETE FROM contacts WHERE id in ('{$this->_resultId}', '{$this->_resultId2}')");
     $GLOBALS['db']->query("DELETE FROM contacts_users WHERE user_id = '{$current_user->id}'");
     $GLOBALS['db']->commit();
     unset($this->c);
     unset($this->c2);
     parent::tearDown();
 }