protected static function _populateDB($perClass = FALSE, &$object = NULL) { if (!parent::_populateDB($perClass, $object)) { return FALSE; } _hrrecruitment_phpunit_populateDB(); return TRUE; }
protected static function _populateDB($perClass = FALSE, &$object = NULL) { if (!parent::_populateDB($perClass, $object)) { return FALSE; } _hrvisa_phpunit_populateDB(); //also create 'Visa Expiration' actvity type $params = array('weight' => 1, 'label' => 'Visa Expiration', 'filter' => 0, 'is_active' => 1, 'is_default' => 0); $result = civicrm_api3('activity_type', 'create', $params); return TRUE; }
/** * Ensure that, if the database is repopulated, CiviVolunteer's install * operations are run, adding custom option group, activity fields, etc. to * the testing db. * * @param type $perClass * @param type $object * @return boolean */ protected static function _populateDB($perClass = FALSE, &$object = NULL) { if (!parent::_populateDB($perClass, $object)) { return FALSE; } // code adapted from CRM_Volunteer_Upgrader::install(). $upgrader = new CRM_Volunteer_Upgrader('org.civicrm.volunteer', dirname(__FILE__) . '/../../'); $activityTypeId = $upgrader->createActivityType(CRM_Volunteer_BAO_Assignment::CUSTOM_ACTIVITY_TYPE); $smarty = CRM_Core_Smarty::singleton(); $smarty->assign('volunteer_custom_activity_type_name', CRM_Volunteer_BAO_Assignment::CUSTOM_ACTIVITY_TYPE); $smarty->assign('volunteer_custom_group_name', CRM_Volunteer_BAO_Assignment::CUSTOM_GROUP_NAME); $smarty->assign('volunteer_custom_option_group_name', CRM_Volunteer_BAO_Assignment::ROLE_OPTION_GROUP); $smarty->assign('volunteer_activity_type_id', $activityTypeId); $customIDs = $upgrader->findCustomGroupValueIDs(); $smarty->assign('customIDs', $customIDs); $upgrader->executeCustomDataTemplateFile('volunteer-customdata.xml.tpl'); $upgrader->createVolunteerActivityStatus(); return TRUE; }
protected static function _populateDB($perClass = FALSE, &$object = NULL) { if (!parent::_populateDB($perClass, $object)) { return FALSE; } //populate vacancy_status of type Application $result = civicrm_api3('OptionGroup', 'create', array('name' => 'vacancy_status', 'title' => ts('Vacancy Status'), 'is_reserved' => 1, 'is_active' => 1)); $vacancyStatus = array('Draft' => ts('Draft'), 'Open' => ts('Open'), 'Closed' => ts('Closed'), 'Cancelled' => ts('Cancelled'), 'Rejected' => ts('Rejected')); $weight = 1; foreach ($vacancyStatus as $name => $label) { $statusParam = array('option_group_id' => $result['id'], 'label' => $label, 'name' => $name, 'value' => $weight++, 'is_active' => 1); if ($name == 'Draft') { $statusParam['is_default'] = 1; } elseif ($name == 'Open') { $statusParam['is_reserved'] = 1; } civicrm_api3('OptionValue', 'create', $statusParam); } $import = new CRM_Utils_Migrate_Import(); $import->run(CRM_Extension_System::singleton()->getMapper()->keyToBasePath('org.civicrm.hrrecruitment') . '/xml/auto_install.xml'); return TRUE; }