当前位置: 首页>>代码示例>>PHP>>正文


PHP SugarTestHelper::setUp方法代码示例

本文整理汇总了PHP中SugarTestHelper::setUp方法的典型用法代码示例。如果您正苦于以下问题:PHP SugarTestHelper::setUp方法的具体用法?PHP SugarTestHelper::setUp怎么用?PHP SugarTestHelper::setUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SugarTestHelper的用法示例。


在下文中一共展示了SugarTestHelper::setUp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 public function setUp()
 {
     SugarTestHelper::setUp('beanList');
     SugarTestHelper::setUp('beanFiles');
     SugarTestHelper::setUp('app_strings');
     SugarTestHelper::setUp('app_list_strings');
     $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser();
     $unid = uniqid();
     $contact = new Contact();
     $contact->id = 'l_' . $unid;
     $contact->first_name = 'Greg';
     $contact->last_name = 'Brady';
     $contact->new_with_id = true;
     $contact->save();
     $this->_contact = $contact;
     if (file_exists(sugar_cached('modules/unified_search_modules.php'))) {
         $this->_hasUnifiedSearchModulesConfig = true;
         copy(sugar_cached('modules/unified_search_modules.php'), sugar_cached('modules/unified_search_modules.php.bak'));
         unlink(sugar_cached('modules/unified_search_modules.php'));
     }
     if (file_exists('custom/modules/unified_search_modules_display.php')) {
         $this->_hasUnifiedSearchModulesDisplay = true;
         copy('custom/modules/unified_search_modules_display.php', 'custom/modules/unified_search_modules_display.php.bak');
         unlink('custom/modules/unified_search_modules_display.php');
     }
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:26,代码来源:UnifiedSearchAdvancedTest.php

示例2: createRelationship

 /**
  * Create a relationship
  *
  * Params should be passed in as this:
  *
  * array(
  *       'relationship_type' => 'one-to-many',
  *       'lhs_module' => 'Accounts',
  *       'rhs_module' => 'Accounts',
  *   )
  *
  * @static
  * @param array $relationship_def
  * @return ActivitiesRelationship|bool|ManyToManyRelationship|ManyToOneRelationship|OneToManyRelationship|OneToOneRelationship
  */
 public static function createRelationship(array $relationship_def)
 {
     if (!self::checkRequiredFields($relationship_def)) {
         return false;
     }
     $relationships = new DeployedRelationships($relationship_def['lhs_module']);
     if (!isset($relationship_def['view_module'])) {
         $relationship_def['view_module'] = $relationship_def['lhs_module'];
     }
     $REQUEST_Backup = $_REQUEST;
     $_REQUEST = $relationship_def;
     $relationship = $relationships->addFromPost();
     $relationships->save();
     $relationships->build();
     LanguageManager::clearLanguageCache($relationship_def['lhs_module']);
     SugarRelationshipFactory::rebuildCache();
     // rebuild the dictionary to make sure that it has the new relationship in it
     SugarTestHelper::setUp('dictionary');
     // reset the link fields since we added one
     VardefManager::$linkFields = array();
     $_REQUEST = $REQUEST_Backup;
     unset($REQUEST_Backup);
     self::$_relsAdded[] = $relationship->getDefinition();
     return $relationship;
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:40,代码来源:SugarTestRelationshipUtilities.php

示例3: setUp

 public function setUp()
 {
     SugarTestHelper::setUp('beanFiles');
     SugarTestHelper::setUp('beanList');
     SugarTestHelper::setUp('current_user');
     $this->_opportunity = new MockOpportunity();
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:7,代码来源:Bug42727Test.php

示例4: setUp

 public function setUp()
 {
     SugarTestHelper::setUp('current_user', array(true, 1));
     SugarTestHelper::setUp('app_list_strings');
     SugarTestHelper::setUp('beanFiles');
     SugarTestHelper::setUp('beanList');
     parent::setUp();
     $this->relationships = new DeployedRelationships('Products');
     $definition = array('lhs_module' => 'Accounts', 'relationship_type' => 'one-to-many', 'rhs_module' => 'ProjectTask');
     $this->relationship = RelationshipFactory::newRelationship($definition);
     $this->relationships->add($this->relationship);
     $this->relationships->save();
     $this->relationships->build();
     SugarTestHelper::setUp('relation', array('Accounts', 'ProjectTask'));
     $searchDefs = array('layout' => array('advanced_search' => array($this->relationship->getName() . '_name' => array('type' => 'relate', 'link' => true, 'label' => '', 'id' => strtoupper($this->relationship->getJoinKeyLHS()), 'width' => '10%', 'default' => true, 'name' => $this->relationship->getName() . '_name'))), 'templateMeta' => array('maxColumns' => '3', 'maxColumnsBasic' => '4', 'widths' => array('label' => '10', 'field' => '30')));
     // Add new field to advanced search layout
     if (file_exists("custom/modules/ProjectTask/metadata/searchdefs.php")) {
         $this->_savedSearchDefs = file_get_contents("custom/modules/ProjectTask/metadata/searchdefs.php");
     }
     write_array_to_file("searchdefs['ProjectTask']", $searchDefs, 'custom/modules/ProjectTask/metadata/searchdefs.php');
     if (file_exists("modules/ProjectTask/metadata/SearchFields.php")) {
         $this->_savedSearchFields = file_get_contents("modules/ProjectTask/metadata/SearchFields.php");
     }
     write_array_to_file("searchFields['ProjectTask']", $this->_localSearchFields['ProjectTask'], 'modules/ProjectTask/metadata/SearchFields.php');
     // Creates linked test account, project and project task
     $this->_project = SugarTestProjectUtilities::createProject();
     $this->_account = SugarTestAccountUtilities::createAccount();
     $projectTaskData = array('project_id' => $this->_project->id, 'parent_task_id' => '', 'project_task_id' => '1', 'percent_complete' => '0', 'name' => 'Test Task 1', 'duration_unit' => 'Days', 'duration' => '1');
     $this->_projectTask = SugarTestProjectTaskUtilities::createProjectTask($projectTaskData);
     $this->_projectTask->{$this->relationship->getName()}->add($this->_account);
     $this->_projectTask->save();
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:32,代码来源:Bug50575Test.php

示例5: setUp

 public function setUp()
 {
     SugarTestHelper::setUp('beanList');
     SugarTestHelper::setUp('beanFiles');
     SugarTestHelper::setUp('app_strings');
     SugarTestHelper::setUp('app_list_strings');
     SugarTestHelper::setUp('mod_strings', array('ModuleBuilder'));
     SugarTestHelper::setUp('current_user', array(true, 1));
     $_POST = $_REQUEST = $this->getPostData();
     $this->accountFieldWidget = get_widget($_REQUEST['type']);
     $this->accountFieldWidget->populateFromPost();
     $module = $_REQUEST['view_module'];
     $this->accountField = new DynamicField($module);
     $class_name = $GLOBALS['beanList'][$module];
     require_once $GLOBALS['beanFiles'][$class_name];
     $mod = new $class_name();
     $this->accountField->setup($mod);
     $this->accountFieldWidget->save($this->accountField);
     $_POST['view_module'] = $_REQUEST['view_module'] = 'Opportunities';
     $this->opportunityFieldWidget = get_widget($_REQUEST['type']);
     $this->opportunityFieldWidget->populateFromPost();
     $module = $_REQUEST['view_module'];
     $this->opportunityField = new DynamicField($module);
     $class_name = $GLOBALS['beanList'][$module];
     require_once $GLOBALS['beanFiles'][$class_name];
     $mod = new $class_name();
     $this->opportunityField->setup($mod);
     $this->opportunityFieldWidget->save($this->opportunityField);
     $repair = new RepairAndClear();
     $repair->repairAndClearAll(array('rebuildExtensions', 'clearVardefs'), array($GLOBALS['beanList']['Accounts'], $GLOBALS['beanList']['Opportunities']), true, false);
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:31,代码来源:Bug56423Test.php

示例6: setUp

 public function setUp()
 {
     SugarTestHelper::setUp('beanList');
     SugarTestHelper::setUp('beanFiles');
     SugarTestHelper::setUp('current_user', array(true, 1));
     $this->filename = $GLOBALS['sugar_config']['upload_dir'] . 'test.vcf';
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:7,代码来源:Bug60613Test.php

示例7: setUp

 public function setUp()
 {
     SugarTestHelper::setUp('beanList');
     SugarTestHelper::setUp('beanFiles');
     SugarTestHelper::setUp('current_user');
     $this->case = BeanFactory::getBean('Cases');
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:7,代码来源:Bug63989Test.php

示例8: setUp

 public function setUp()
 {
     SugarTestHelper::setUp('beanFiles');
     SugarTestHelper::setUp('beanList');
     SugarTestHelper::setUp('current_user');
     $this->importdir = ImportCacheFiles::getImportDir();
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:7,代码来源:ImportCacheFilesTest.php

示例9: setUp

 public function setUp()
 {
     global $current_user, $sugar_config;
     SugarTestHelper::setUp('current_user', array(true));
     $current_user->setPreference('dec_sep', ',');
     $current_user->setPreference('num_grp_sep', '.');
     $current_user->setPreference('default_currency_significant_digits', 3);
     SugarTestHelper::setUp('app_list_strings');
     SugarTestHelper::setUp('beanFiles');
     SugarTestHelper::setUp('beanList');
     parent::setUp();
     $this->lm = new LayoutManager();
     $this->lm->setAttribute('reporter', new stdClass());
     $this->currency_51568 = new Currency();
     $this->currency_51568->symbol = 'TT';
     $this->currency_51568->conversion_rate = 0.5;
     $this->currency_51568->save(false);
     $this->currency_system = new Currency();
     $this->currency_system->retrieve(-99);
     $this->backupSymbol = $this->currency_system->symbol;
     $this->currency_system->symbol = '¥';
     $this->currency_system->save(false);
     $sugar_config['default_currency_symbol'] = '¥';
     get_number_seperators(true);
 }
开发者ID:thsonvt,项目名称:sugarcrm_dev,代码行数:25,代码来源:Bug51568Test.php

示例10: setUp

 protected function setUp()
 {
     SugarTestHelper::setUp('beanFiles');
     SugarTestHelper::setUp('beanList');
     SugarTestHelper::setUp('current_user', array(true, 1));
     $this->contact = SugarTestContactUtilities::createContact();
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:7,代码来源:Bug53516Test.php

示例11: setUp

 public function setUp()
 {
     $this->_file = $GLOBALS['sugar_config']['upload_dir'] . 'Bug25736Test.csv';
     SugarTestHelper::setUp('beanFiles');
     SugarTestHelper::setUp('beanList');
     SugarTestHelper::setUp('current_user');
 }
开发者ID:thsonvt,项目名称:sugarcrm_dev,代码行数:7,代码来源:Bug25736ImportTest.php

示例12: setUp

 public function setUp()
 {
     SugarTestHelper::setUp('beanFiles');
     SugarTestHelper::setUp('beanList');
     SugarTestHelper::setUp('current_user');
     $unid = uniqid();
     $time = date('Y-m-d H:i:s');
     $contact = new Contact();
     $contact->id = 'c_' . $unid;
     $contact->first_name = 'testfirst';
     $contact->last_name = 'testlast';
     $contact->new_with_id = true;
     $contact->disable_custom_fields = true;
     $contact->save();
     $this->contact = $contact;
     $account = new Account();
     $account->id = 'a_' . $unid;
     $account->first_name = 'testfirst';
     $account->last_name = 'testlast';
     $account->assigned_user_id = 'SugarUser';
     $account->new_with_id = true;
     $account->disable_custom_fields = true;
     $account->save();
     $this->account = $account;
     $ac_id = 'ac_' . $unid;
     $this->ac_id = $ac_id;
     //Accounts to Contacts
     $GLOBALS['db']->query("INSERT INTO accounts_contacts (id , contact_id, account_id, date_modified, deleted) values ('{$ac_id}', '{$contact->id}', '{$account->id}', '{$time}', 0)");
     $_REQUEST['relate_id'] = $this->contact->id;
     $_REQUEST['relate_to'] = 'projects_contacts';
 }
开发者ID:newLoki,项目名称:sugarcrm_dev,代码行数:31,代码来源:Bug37123Test.php

示例13: setup

 public function setup()
 {
     SugarTestHelper::setUp('beanFiles');
     SugarTestHelper::setUp('beanList');
     SugarTestHelper::setUp('app_list_strings');
     SugarTestHelper::setUp('current_user');
 }
开发者ID:newLoki,项目名称:sugarcrm_dev,代码行数:7,代码来源:CallHelperTest.php

示例14: setup

 public function setup()
 {
     SugarTestHelper::setUp('app_strings');
     global $current_user;
     // Create Anon User setted on GMT+2 TimeZone
     $current_user = SugarTestUserUtilities::createAnonymousUser();
     $current_user->setPreference('datef', "d/m/Y");
     $current_user->setPreference('timef', "H:i:s");
     $current_user->setPreference('timezone', "Europe/Rome");
     // new object to avoid TZ caching
     $this->timedate = new TimeDate();
     $this->meetingsArr = array();
     // Create a Bunch of Meetings
     $d = 12;
     $cnt = 0;
     while ($d < 15) {
         $this->meetingsArr[$cnt] = new Meeting();
         $this->meetingsArr[$cnt]->name = 'Bug45287 Meeting ' . ($cnt + 1);
         $this->meetingsArr[$cnt]->date_start = $this->timedate->to_display_date_time(gmdate("Y-m-d H:i:s", mktime(10 + $cnt, 30, 00, 7, $d, 2011)));
         $this->meetingsArr[$cnt]->save();
         $d++;
         $cnt++;
     }
     $this->searchDefs = array("Meetings" => array("layout" => array("basic_search" => array("name" => array("name" => "name", "default" => true, "width" => "10%"), "date_start" => array("name" => "date_start", "default" => true, "width" => "10%", "type" => "datetimecombo")))));
     $this->searchFields = array("Meetings" => array("name" => array("query_type" => "default"), "date_start" => array("query_type" => "default"), "range_date_start" => array("query_type" => "default", "enable_range_search" => 1, "is_date_field" => 1), "range_date_start" => array("query_type" => "default", "enable_range_search" => 1, "is_date_field" => 1), "start_range_date_start" => array("query_type" => "default", "enable_range_search" => 1, "is_date_field" => 1), "end_range_date_start" => array("query_type" => "default", "enable_range_search" => 1, "is_date_field" => 1)));
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:26,代码来源:Bug45287Test.php

示例15: setUp

 public function setUp()
 {
     SugarTestHelper::setUp('beanFiles');
     SugarTestHelper::setUp('beanList');
     SugarTestHelper::setUp('current_user');
     $this->contact = SugarTestContactUtilities::createContact();
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:7,代码来源:Bug44138Test.php


注:本文中的SugarTestHelper::setUp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。