Example #1
0
 public function tearDown()
 {
     SugarTestAccountUtilities::removeAllCreatedAccounts();
     SugarTestContactUtilities::removeAllCreatedContacts();
     SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
     SugarTestHelper::tearDown();
 }
Example #2
0
 /**
  * Create a lead and convert it to an existing Account and Contact
  */
 public function testConvertLinkingExistingContact()
 {
     // Create records
     $lead = SugarTestLeadUtilities::createLead();
     $account = SugarTestAccountUtilities::createAccount();
     $contact = SugarTestContactUtilities::createContact();
     // ConvertLead to an existing Contact and Account
     $_REQUEST = array('module' => 'Leads', 'record' => $lead->id, 'isDuplicate' => 'false', 'action' => 'ConvertLead', 'convert_create_Contacts' => 'false', 'report_to_name' => $contact->name, 'reports_to_id' => $contact->id, 'convert_create_Accounts' => 'false', 'account_name' => $account->name, 'account_id' => $account->id, 'handle' => 'save');
     // Call display to trigger conversion
     $vc = new ViewConvertLead();
     $vc->display();
     // Refresh Lead
     $leadId = $lead->id;
     $lead = new Lead();
     $lead->retrieve($leadId);
     // Refresh Contact
     $contactId = $contact->id;
     $contact = new Contact();
     $contact->retrieve($contactId);
     // Check if contact it's linked properly
     $this->assertEquals($contact->id, $lead->contact_id, 'Contact not linked with Lead successfully.');
     // Check if account is linked with lead properly
     $this->assertEquals($account->id, $lead->account_id, 'Account not linked with Lead successfully.');
     // Check if account is linked with contact properly
     $this->assertEquals($account->id, $contact->account_id, 'Account not linked with Contact successfully.');
     // Check Lead Status, should be converted
     $this->assertEquals('Converted', $lead->status, "Lead status should be 'Converted'.");
 }
 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();
 }
 public function tearDown()
 {
     $this->contact->field_defs = $this->defs;
     SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
     unset($GLOBALS['current_user']);
     SugarTestContactUtilities::removeAllCreatedContacts();
 }
 public function tearDown()
 {
     SugarTestHelper::tearDown();
     SugarTestAccountUtilities::removeAllCreatedAccounts();
     SugarTestContactUtilities::removeAllCreatedContacts();
     SugarTestLeadUtilities::removeAllCreatedLeads();
 }
Example #6
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 #7
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 #8
0
 public function tearDown()
 {
     SugarTestAccountUtilities::removeAllCreatedAccounts();
     SugarTestContactUtilities::removeAllCreatedContacts();
     parent::tearDown();
     parent::_tearDownTestUser();
     SugarTestHelper::tearDown();
 }
Example #9
0
 public function tearDown()
 {
     SugarTestContactUtilities::removeAllCreatedContacts();
     unset($this->contact);
     unset($GLOBALS['beanFiles'], $GLOBALS['beanList']);
     SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
     unset($GLOBALS['current_user']);
 }
Example #10
0
 public static function tearDownAfterClass()
 {
     SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
     SugarTestContactUtilities::removeAllCreatedContacts();
     SugarTestAccountUtilities::removeAllCreatedAccounts();
     unset($GLOBALS['current_user']);
     $GLOBALS['db']->commit();
 }
Example #11
0
 public static function tearDownAfterClass()
 {
     unset($_REQUEST['data']);
     unset($_REQUEST['query']);
     SugarTestContactUtilities::removeAllCreatedContacts();
     unset($GLOBALS['beanList']);
     unset($GLOBALS['beanFiles']);
 }
Example #12
0
 public function tearDown()
 {
     SugarTestContactUtilities::removeAllCreatedContacts();
     SugarTestAccountUtilities::removeAllCreatedAccounts();
     SugarTestEmailUtilities::removeAllCreatedEmails();
     SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
     unset($GLOBALS['current_user']);
 }
 public function tearDown()
 {
     SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
     SugarTestContactUtilities::removeAllCreatedContacts();
     SugarTestContactUtilities::removeCreatedContactsEmailAddresses();
     unset($this->form);
     unset($this->contact1);
 }
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 tearDown()
 {
     SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
     SugarTestContactUtilities::removeAllCreatedContacts();
     SugarTestAccountUtilities::removeAllCreatedAccounts();
     SugarTestTrackerUtility::removeAllTrackerEntries();
     unset($GLOBALS['current_user']);
     unset($GLOBALS['app_strings']);
 }
Example #16
0
 /**
  * Create contact function
  */
 public function createContact($account_id, $account_name)
 {
     $contact = SugarTestContactUtilities::createContact();
     $contact->account_id = $account_id;
     $contact->account_name = $account_name;
     $contact->save();
     $GLOBALS['db']->commit();
     return $contact;
 }
Example #17
0
 public function tearDown()
 {
     SugarTestHelper::tearDown();
     SugarTestOpportunityUtilities::removeAllCreatedOpportunities();
     SugarTestEmailUtilities::removeAllCreatedEmails();
     SugarTestContactUtilities::removeAllCreatedContacts();
     SugarTestAccountUtilities::removeAllCreatedAccounts();
     $GLOBALS['app'] = $this->application;
 }
Example #18
0
 public function testDisplay()
 {
     $view = new ViewVcard();
     $view->bean = SugarTestContactUtilities::createContact();
     $view->module = 'Contacts';
     $view->display();
     SugarTestContactUtilities::removeAllCreatedContacts();
     $this->expectOutputRegex('/BEGIN\\:VCARD/');
 }
Example #19
0
 public function setUp()
 {
     $this->_soapURL = $GLOBALS['sugar_config']['site_url'] . '/soap.php';
     parent::setUp();
     $this->contact = SugarTestContactUtilities::createContact();
     $this->prospect = new Prospect();
     $this->prospect->email1 = $this->contact->email1;
     $this->prospect->save();
     $GLOBALS['db']->commit();
 }
Example #20
0
 protected function tearDown()
 {
     SugarTestContactUtilities::removeAllCreatedContacts();
     SugarTestContactUtilities::removeCreatedContactsEmailAddresses();
     SugarTestContactUtilities::removeCreatedContactsUsersRelationships();
     SugarTestMeetingUtilities::removeAllCreatedMeetings();
     SugarTestMeetingUtilities::removeMeetingContacts();
     SugarTestMeetingUtilities::removeMeetingUsers();
     SugarTestHelper::tearDown();
 }
Example #21
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 #22
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 #23
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 #24
0
 public function testgetEmailLink()
 {
     $GLOBALS['sugar_config']['email_default_client'] = "sugar";
     $this->_contact = SugarTestContactUtilities::createContact();
     $this->_contact->id = 'abcdefg';
     $this->_contact->first_name = "FIRST-NAME";
     $this->_contact->last_name = "LAST-NAME";
     $this->_contact->email1 = "*****@*****.**";
     $this->_contact->object_name = 'Contact';
     $this->_contact->module_dir = 'module_dir';
     $this->_contact->createLocaleFormattedName = true;
     $test = $this->_user->getEmailLink("email1", $this->_contact);
     $pattern = "/.*\"to_email_addrs\":\"LAST-NAME FIRST-NAME \\\\u003Ctest@test.test\\\\u003E\".*/";
     $this->assertRegExp($pattern, $test);
 }
Example #25
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 #26
0
 /**
  * setUp
  * Override the setup from SoapTestCase to also create the seed search data for Accounts and Contacts.
  */
 public function setUp()
 {
     $this->_soapURL = $GLOBALS['sugar_config']['site_url'] . '/soap.php';
     parent::setUp();
     $this->_login();
     // Logging in just before the SOAP call as this will also commit any pending DB changes
     $this->contact = SugarTestContactUtilities::createContact();
     $this->contact->contacts_users_id = $GLOBALS['current_user']->id;
     $this->contact->save();
     $this->account = SugarTestAccountUtilities::createAccount();
     $this->account->email1 = $this->contact->email1;
     $this->account->save();
     $this->lead = SugarTestLeadUtilities::createLead();
     $this->lead->email1 = $this->contact->email1;
     $this->lead->save();
     $GLOBALS['db']->commit();
     // Making sure these changes are committed to the database
 }
Example #27
0
 public function testGetEntryWhenContactHasMultipleAccountRelationshipsWorks()
 {
     $contact = SugarTestContactUtilities::createContact();
     $account1 = SugarTestAccountUtilities::createAccount();
     $account2 = SugarTestAccountUtilities::createAccount();
     $contact->load_relationship('accounts');
     $contact->accounts->add($account1->id);
     $contact->accounts->add($account2->id);
     $this->_login();
     $parameters = array('session' => $this->_sessionId, 'module_name' => 'Contacts', 'query' => "contacts.id = '{$contact->id}'", 'order_by' => '', 'offset' => 0, 'select_fields' => array('id', 'account_id', 'account_name'), 'max_results' => 250, 'deleted' => 0);
     $result = $this->_soapClient->call('get_entry_list', $parameters);
     $account_names = array($account1->name, $account2->name);
     $account_ids = array($account1->id, $account2->id);
     /*
     $this->assertEquals($result['entry_list'][0]['name_value_list'][1]['value'],$account1->name);
     $this->assertEquals($result['entry_list'][0]['name_value_list'][2]['value'],$account1->id);
     $this->assertEquals($result['entry_list'][1]['name_value_list'][1]['value'],$account2->name);
     $this->assertEquals($result['entry_list'][1]['name_value_list'][2]['value'],$account2->id);
     */
     $this->assertTrue(in_array($result['entry_list'][0]['name_value_list'][1]['value'], $account_names));
     $this->assertTrue(in_array($result['entry_list'][1]['name_value_list'][1]['value'], $account_names));
     $this->assertTrue(in_array($result['entry_list'][0]['name_value_list'][2]['value'], $account_ids));
     $this->assertTrue(in_array($result['entry_list'][1]['name_value_list'][2]['value'], $account_ids));
 }
Example #28
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 #30
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']);
 }