本文整理汇总了PHP中CiviUnitTestCase::_populateDB方法的典型用法代码示例。如果您正苦于以下问题:PHP CiviUnitTestCase::_populateDB方法的具体用法?PHP CiviUnitTestCase::_populateDB怎么用?PHP CiviUnitTestCase::_populateDB使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CiviUnitTestCase
的用法示例。
在下文中一共展示了CiviUnitTestCase::_populateDB方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _populateDB
protected static function _populateDB($perClass = FALSE, &$object = NULL)
{
if (!parent::_populateDB($perClass, $object)) {
return FALSE;
}
_hrrecruitment_phpunit_populateDB();
return TRUE;
}
示例2: _populateDB
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;
}
示例3: _populateDB
/**
* 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;
}
示例4: _populateDB
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;
}