public function setUp() { SugarTestHelper::setUp('beanFiles'); SugarTestHelper::setUp('beanList'); SugarTestHelper::setUp('current_user'); $this->contact = SugarTestContactUtilities::createContact(); }
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(); }
/** * 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'."); }
protected function setUp() { SugarTestHelper::setUp('beanFiles'); SugarTestHelper::setUp('beanList'); SugarTestHelper::setUp('current_user', array(true, 1)); $this->contact = SugarTestContactUtilities::createContact(); }
public function setUp() { global $current_user; $this->_soapURL = $GLOBALS['sugar_config']['site_url'] . '/soap.php'; //Clean up any possible contacts not deleted $GLOBALS['db']->query("DELETE FROM contacts WHERE first_name = 'NoBlankFieldUpdate' AND last_name = 'OnFirstSyncTest'"); $current_user = SugarTestUserUtilities::createAnonymousUser(); $contact = SugarTestContactUtilities::createContact(); $contact->first_name = 'NoBlankFieldUpdate'; $contact->last_name = 'OnFirstSyncTest'; $contact->phone_mobile = '867-5309'; $contact->email1 = '*****@*****.**'; $contact->title = 'Jenny - I Got Your Number'; $contact->disable_custom_fields = true; $contact->save(); $this->c = $contact; $GLOBALS['db']->query("DELETE FROM contacts WHERE first_name = 'Collin' AND last_name = 'Lee'"); //Manually create a contact entry $contact2 = new Contact(); $contact2->title = 'Jenny - I Got Your Number'; $contact2->first_name = 'Collin'; $contact2->last_name = 'Lee'; $contact2->phone_mobile = '867-5309'; $contact2->disable_custom_fields = true; $contact2->email1 = ''; $contact2->email2 = ''; $contact2->save(); $this->c2 = $contact2; //DELETE contact_users entries that may have remained $GLOBALS['db']->query("DELETE FROM contacts_users WHERE user_id = '{$current_user->id}'"); parent::setUp(); $GLOBALS['db']->commit(); }
public function setUp() { $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser(); $this->contact = SugarTestContactUtilities::createContact(); $this->task = SugarTestTaskUtilities::createTask(); $this->task->contact_id = $this->contact->id; $this->task->save(); }
public function setUp() { $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser(); $this->contact = SugarTestContactUtilities::createContact(); $this->account = SugarTestAccountUtilities::createAccount(); $override_data = array('parent_type' => 'Accounts', 'parent_id' => $this->account->id); $this->email = SugarTestEmailUtilities::createEmail('', $override_data); }
public function setUp() { global $timedate, $current_user; $timedate = TimeDate::getInstance(); require 'include/modules.php'; $GLOBALS['beanList'] = $beanList; $GLOBALS['beanFiles'] = $beanFiles; $current_user = SugarTestUserUtilities::createAnonymousUser(); $this->nowTime = $timedate->asDb($timedate->getNow()->get("-10 minutes")); $this->tenMinutesLaterTime = $timedate->asDb($timedate->getNow()->get("+10 minutes")); $current_user->is_admin = 1; $current_user->save(); $this->meeting = SugarTestMeetingUtilities::createMeeting(); $this->meeting->team_id = $current_user->team_id; $this->meeting->team_set_id = $current_user->team_set_id; $this->meeting->team_id = $current_user->team_id; $this->meeting->team_set_id = $current_user->team_set_id; $this->meeting->assigned_user_id = $current_user->id; $this->meeting->save(); $this->meeting->load_relationship('users'); $this->meeting->users->add($current_user); $this->call = SugarTestCallUtilities::createCall(); $this->call->team_id = $current_user->team_id; $this->call->team_set_id = $current_user->team_set_id; $this->call->assigned_user_id = $current_user->id; $this->call->save(); $this->call->load_relationships('users'); $this->call->users->add($current_user); $this->contact = SugarTestContactUtilities::createContact(); $this->contact->email1 = '*****@*****.**'; $this->contact->contacts_users_id = $current_user->id; $this->contact->load_relationship('user_sync'); $this->contact->user_sync->add($current_user); $this->contact->sync_contact = 1; $this->contact->save(); $this->task = SugarTestTaskUtilities::createTask(); $this->task->assigned_user_id = $current_user->id; $this->task->team_id = $current_user->id; $this->task->team_set_id = $current_user->id; $this->task->save(); //$this->useOutputBuffering = false; /** * This provider returns an Array of Array data. Each Array contains the following data * 0 => String - Left side module name * 1 => String - Right side module name * 2 => String - Relationship Query * 3 => boolean to return deleted records or not (this is actually ignored by the function) * 4 => integer offset to start with * 5 => integer value for the maximum number of results * 6 => array of fields to select and return * 7 => load_relationships - Relationship name to use * 8 => array of expected results * 9 => integer of expected total count * 10 => array of expected soap error * @return array The provider array */ $this->testData = array(array('Users', 'Meetings', "( (m1.date_modified > '{$this->nowTime}' AND m1.date_modified <= '{$this->tenMinutesLaterTime}' AND m1.deleted = 0) OR (m1.date_modified > '{$this->nowTime}' AND m1.date_modified <= '{$this->tenMinutesLaterTime}' AND m1.deleted = 1) AND m1.id IN ('{$this->meeting->id}')) OR (m1.id NOT IN ('{$this->meeting->id}') AND m1.deleted = 0) AND m2.id = '{$current_user->id}'", 0, 0, 3000, $this->callsAndMeetingsSelectFields, 'meetings_users', array('id' => $this->meeting->id), 1, $this->noSoapErrorArray), array('Users', 'Calls', "( m1.deleted = 0) AND m2.id = '{$current_user->id}'", 0, 0, 3000, $this->callsAndMeetingsSelectFields, 'calls_users', array('id' => $this->call->id), 1, $this->noSoapErrorArray), array('Users', 'Contacts', "( (m1.date_modified > '{$this->nowTime}' AND m1.date_modified <= '{$this->tenMinutesLaterTime}' AND {0}.deleted = 0) OR ({0}.date_modified > '{$this->nowTime}' AND {0}.date_modified <= '{$this->tenMinutesLaterTime}' AND {0}.deleted = 1) AND m1.id IN ('31a219bd-b9c1-2c3e-aa5d-4f2778ab0347','c794bc39-e4fb-f515-f1d5-4f285ca88965','d51a0555-8f84-9e62-0fbc-4f2787b5d839','a1219ae6-5a6b-0d1b-c49f-4f2854bc2912')) OR (m1.id NOT IN ('31a219bd-b9c1-2c3e-aa5d-4f2778ab0347','c794bc39-e4fb-f515-f1d5-4f285ca88965','d51a0555-8f84-9e62-0fbc-4f2787b5d839','a1219ae6-5a6b-0d1b-c49f-4f2854bc2912') AND {0}.deleted = 0) AND m2.id = '1'", 0, 0, 3000, $this->contactsSelectFields, 'contacts_users', array('id' => $this->contact->id, 'email1' => '*****@*****.**'), 1, $this->noSoapErrorArray), array('Users', 'Tasks', " ( (m1.date_modified > '{$this->nowTime}' AND m1.date_modified <= '{$this->tenMinutesLaterTime}' AND {0}.deleted = 0) OR ({0}.date_modified > '{$this->nowTime}' AND {0}.date_modified <= '{$this->tenMinutesLaterTime}' AND {0}.deleted = 1) AND m1.id IN ('{$this->task->id}')) OR (m1.id NOT IN ('{$this->task->id}') AND {0}.deleted = 0) AND m2.id = '1'", 0, 0, 3000, $this->tasksSelectFields, 'tasks_assigned_user', array('id' => $this->task->id), 1, $this->noSoapErrorArray)); }
public function testDisplay() { $view = new ViewVcard(); $view->bean = SugarTestContactUtilities::createContact(); $view->module = 'Contacts'; $view->display(); SugarTestContactUtilities::removeAllCreatedContacts(); $this->expectOutputRegex('/BEGIN\\:VCARD/'); }
public function setUp() { $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser(); $this->_user = SugarTestUserUtilities::createAnonymousUser(); $this->_user->status = 'Active'; $this->_user->is_admin = 1; $this->_user->save(); $this->_contact = SugarTestContactUtilities::createContact(); }
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(); }
/** * 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; }
public function setUp() { SugarTestHelper::setUp('beanFiles'); SugarTestHelper::setUp('beanList'); SugarTestHelper::setUp('current_user'); $this->Accounts = SugarTestAccountUtilities::createAccount(); $this->Contacts = SugarTestContactUtilities::createContact(); $this->Leads = SugarTestLeadUtilities::createLead(); }
public function setUp() { SugarTestHelper::setUp('app_list_strings'); SugarTestHelper::setUp('app_strings'); SugarTestHelper::setUp('current_user'); $this->contact = SugarTestContactUtilities::createContact(); $this->task = SugarTestTaskUtilities::createTask(); $this->task->contact_id = $this->contact->id; $this->task->save(); }
public function setUp() { $GLOBALS['app_list_strings'] = return_app_list_strings_language($GLOBALS['current_language']); $GLOBALS['app_strings'] = return_application_language($GLOBALS['current_language']); $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser(); $this->contact = SugarTestContactUtilities::createContact(); $this->task = SugarTestTaskUtilities::createTask(); $this->task->contact_id = $this->contact->id; $this->task->save(); }
public function setUp() { $beanList = array(); $beanFiles = array(); require 'include/modules.php'; $GLOBALS['beanList'] = $beanList; $GLOBALS['beanFiles'] = $beanFiles; $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser(); $this->contact = SugarTestContactUtilities::createContact(); }
public function setUp() { global $beanFiles, $beanList, $current_user; $current_user = SugarTestUserUtilities::createAnonymousUser(); $this->account = SugarTestAccountUtilities::createAccount(); $this->contact = SugarTestContactUtilities::createContact(); $this->account->load_relationship('contacts'); $this->account->contacts->add($this->contact); $this->account2 = SugarTestAccountUtilities::createAccount(); $GLOBALS['db']->commit(); }
public function setUp() { SugarTestHelper::setUp('beanFiles'); SugarTestHelper::setUp('beanList'); SugarTestHelper::setUp('current_user'); SugarTestOpportunityUtilities::createOpportunity(); $opp1 = SugarTestOpportunityUtilities::createOpportunity(); $this->contact = SugarTestContactUtilities::createContact(); $this->contact->load_relationship('opportunities'); $this->contact->opportunities->add($opp1->id); }
public function setUp() { global $app_strings, $app_list_strings; $app_strings = return_application_language($GLOBALS['current_language']); $app_list_strings = return_app_list_strings_language($GLOBALS['current_language']); $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser(); $this->contact = SugarTestContactUtilities::createContact(); $this->account = SugarTestAccountUtilities::createAccount(); $override_data = array('parent_type' => 'Accounts', 'parent_id' => $this->account->id); $this->email = SugarTestEmailUtilities::createEmail('', $override_data); }
public function setUp() { SugarTestHelper::setUp('beanFiles'); SugarTestHelper::setUp('beanList'); SugarTestHelper::setUp('current_user'); $this->account = SugarTestAccountUtilities::createAccount(); $this->contact = SugarTestContactUtilities::createContact(); $this->account->load_relationship('contacts'); $this->account->contacts->add($this->contact); $this->account2 = SugarTestAccountUtilities::createAccount(); $GLOBALS['db']->commit(); }
public function setUp() { $GLOBALS['app_list_strings'] = return_app_list_strings_language($GLOBALS['current_language']); $GLOBALS['app_strings'] = return_application_language($GLOBALS['current_language']); $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser(); $this->contact = SugarTestContactUtilities::createContact(); $this->contact->salutation = 'Ms.'; $this->contact->first_name = 'Lady'; $this->contact->last_name = 'Gaga'; //Save contact with salutation $this->contact->save(); }
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); }
/** * Create test user * */ 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->_meeting = SugarTestMeetingUtilities::createMeeting(); $GLOBALS['db']->commit(); // Making sure these changes are committed to the database }
public function setUp() { SugarTestHelper::setUp('beanFiles'); SugarTestHelper::setUp('beanList'); SugarTestHelper::setUp('current_user'); $this->_soapURL = $GLOBALS['sugar_config']['site_url'] . '/service/v4_1/soap.php'; parent::_setupTestUser(); parent::setUp(); $this->account = SugarTestAccountUtilities::createAccount(); $this->contact = SugarTestContactUtilities::createContact(); $this->account->load_relationship('contacts'); $this->account->contacts->add($this->contact->id); }
public function setUp() { $beanList = array(); $beanFiles = array(); require 'include/modules.php'; $GLOBALS['beanList'] = $beanList; $GLOBALS['beanFiles'] = $beanFiles; $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser(); $GLOBALS['current_user']->status = 'Active'; $GLOBALS['current_user']->is_admin = 1; $GLOBALS['current_user']->save(); $this->field = get_widget('varchar'); $this->field->id = 'Accountstest_custom_c'; $this->field->name = 'test_custom_c'; $this->field->vanme = 'LBL_TEST_CUSTOM_C'; $this->field->comments = NULL; $this->field->help = NULL; $this->field->custom_module = 'Accounts'; $this->field->type = 'varchar'; $this->field->label = 'LBL_TEST_CUSTOM_C'; $this->field->len = 255; $this->field->required = 0; $this->field->default_value = NULL; $this->field->date_modified = '2009-09-14 02:23:23'; $this->field->deleted = 0; $this->field->audited = 0; $this->field->massupdate = 0; $this->field->duplicate_merge = 0; $this->field->reportable = 1; $this->field->importable = 'true'; $this->field->ext1 = NULL; $this->field->ext2 = NULL; $this->field->ext3 = NULL; $this->field->ext4 = NULL; $this->df = new DynamicField('Accounts'); $this->mod = new Account(); $this->df->setup($this->mod); $this->df->addFieldObject($this->field); $this->df->buildCache('Accounts'); VardefManager::clearVardef(); VardefManager::refreshVardefs('Accounts', 'Account'); $this->mod->field_defs = $GLOBALS['dictionary']['Account']['fields']; $this->_contact = SugarTestContactUtilities::createContact(); $this->_account = SugarTestAccountUtilities::createAccount(); $this->_contact->load_relationship('accounts'); $this->_contact->accounts->add($this->_account->id); $this->_account->test_custom_c = 'Custom Field'; $this->_account->save(); $GLOBALS['db']->commit(); // Making sure we commit any changes }
static function setUpBeforeClass() { global $app_strings, $app_list_strings; $app_strings = return_application_language($GLOBALS['current_language']); $app_list_strings = return_app_list_strings_language($GLOBALS['current_language']); $user = new User(); $user->retrieve('1'); $GLOBALS['current_user'] = $user; self::$contact = SugarTestContactUtilities::createContact(); self::$contact->first_name = 'Bug43395'; self::$contact->last_name = 'Test'; self::$contact->salutation = 'Mr.'; self::$contact->save(); }
public function setup() { SugarTestHelper::setUp('beanList'); SugarTestHelper::setUp('beanFiles'); SugarTestHelper::setUp('current_user', array(true, 1)); SugarTestHelper::setUp('app_list_strings'); SugarTestHelper::setUp('mod_strings', array('ModuleBuilder')); parent::setUp(); $this->createCustomField(); $this->getSugarWidgetFieldRelate(); $this->account = SugarTestAccountUtilities::createAccount(); $this->contact1 = SugarTestContactUtilities::createContact(); $this->contact2 = SugarTestContactUtilities::createContact(); }
public function setup() { $GLOBALS['db']->query("DELETE FROM contacts WHERE first_name = 'Mike' AND last_name = 'TheSituationSorrentino'"); $this->form = new ContactFormBase(); $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser(); $GLOBALS['app_strings'] = return_application_language($GLOBALS['current_language']); $GLOBALS['mod_strings'] = return_module_language($GLOBALS['current_language'], 'Contacts'); //Create a test Contact $this->contact1 = SugarTestContactUtilities::createContact(); $this->contact1->first_name = 'Collin'; $this->contact1->last_name = 'Lee'; $this->contact1->save(); $this->contact1->emailAddress->addAddress('*****@*****.**', true, false); $this->contact1->emailAddress->save($this->contact1->id, $this->contact1->module_dir); }
public function setUp() { SugarTestHelper::setUp('beanFiles'); SugarTestHelper::setUp('beanList'); SugarTestHelper::setUp('app_strings'); SugarTestHelper::setUp('app_list_strings'); SugarTestHelper::setUp('mod_strings', array('Contacts')); SugarTestHelper::setUp('current_user'); $this->contact = SugarTestContactUtilities::createContact(); $this->contact->salutation = 'Ms.'; $this->contact->first_name = 'Lady'; $this->contact->last_name = 'Gaga'; //Save contact with salutation $this->contact->save(); }
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); }