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(); }
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('Administration')); SugarTestHelper::setUp('dictionary'); parent::setUp(); $this->createCustom(); $this->acc = SugarTestAccountUtilities::createAccount(); $this->acc2 = SugarTestAccountUtilities::createAccount(); }