本文整理汇总了PHP中CRM_Member_BAO_MembershipType::add方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Member_BAO_MembershipType::add方法的具体用法?PHP CRM_Member_BAO_MembershipType::add怎么用?PHP CRM_Member_BAO_MembershipType::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Member_BAO_MembershipType
的用法示例。
在下文中一共展示了CRM_Member_BAO_MembershipType::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: civicrm_membership_type_create
/**
* Create a Membership Type
*
* This API is used for creating a Membership Type
*
* @param array $params an associative array of name/value property values of civicrm_membership_type
*
* @return array of newly created membership type property values.
* @access public
*/
function civicrm_membership_type_create(&$params)
{
_civicrm_initialize();
if (!is_array($params)) {
return civicrm_create_error('Params need to be of type array!');
}
if (empty($params)) {
return civicrm_create_error('No input parameters present');
}
if (!isset($params['name']) || !isset($params['duration_unit']) || !isset($params['duration_interval'])) {
return civicrm_create_error('Missing require fileds ( name, duration unit,duration interval)');
}
$error = _civicrm_check_required_fields($params, 'CRM_Member_DAO_MembershipType');
if ($error['is_error']) {
return civicrm_create_error($error['error_message']);
}
$ids['membershipType'] = CRM_Utils_Array::value('id', $params);
$ids['memberOfContact'] = CRM_Utils_Array::value('member_of_contact_id', $params);
$ids['contributionType'] = CRM_Utils_Array::value('contribution_type_id', $params);
require_once 'CRM/Member/BAO/MembershipType.php';
$membershipTypeBAO = CRM_Member_BAO_MembershipType::add($params, $ids);
if (is_a($membershipTypeBAO, 'CRM_Core_Error')) {
return civicrm_create_error("Membership is not created");
} else {
$membershipType = array();
_civicrm_object_to_array($membershipTypeBAO, $membershipType);
$values = array();
$values['id'] = $membershipType['id'];
$values['is_error'] = 0;
}
return $values;
}
示例2: createMembershipType
/**
* Helper function to create membership type.
*/
public function createMembershipType()
{
$orgId = Contact::createOrganisation();
$ids = array('memberOfContact' => $orgId);
$params = array('name' => 'Test Type', 'description' => 'test membership type', 'minimum_fee' => 111, 'duration_unit' => 'year', 'period_type' => 'rolling', 'duration_interval' => 1, 'member_org' => NULL, 'fixed_period_start_day' => NULL, 'fixed_period_rollover_day' => NULL, 'action' => 1, 'financial_type_id' => 1, 'relationship_type_id' => 4, 'visibility' => 'Public', 'weight' => 4, 'is_active' => 1, 'contact_check' => 1, 'relationship_direction' => 'a_b', 'member_of_contact_id' => $orgId);
$membershipType = CRM_Member_BAO_MembershipType::add($params, $ids);
$membershipType->orgnizationID = $orgId;
return $membershipType;
}
示例3: setUp
function setUp()
{
parent::setUp();
$params = array('contact_type_a' => 'Individual', 'contact_type_b' => 'Organization', 'name_a_b' => 'Test Employee of', 'name_b_a' => 'Test Employer of');
$this->_relationshipTypeId = $this->relationshipTypeCreate($params);
$this->_orgContactID = $this->organizationCreate();
$this->_financialTypeId = 1;
$params = array('name' => 'test type', 'description' => NULL, 'minimum_fee' => 10, 'duration_unit' => 'year', 'member_of_contact_id' => $this->_orgContactID, 'period_type' => 'fixed', 'duration_interval' => 1, 'financial_type_id' => $this->_financialTypeId, 'relationship_type_id' => $this->_relationshipTypeId, 'visibility' => 'Public', 'is_active' => 1);
$membershipType = CRM_Member_BAO_MembershipType::add($params, $ids);
$this->_membershipTypeID = $membershipType->id;
$this->_mebershipStatusID = $this->membershipStatusCreate('test status');
}
示例4: setUp
function setUp()
{
parent::setUp();
$this->_relationshipTypeId = $this->relationshipTypeCreate($params);
$this->_orgContactID = $this->organizationCreate();
$this->_contributionTypeId = $this->contributionTypeCreate();
$ids = array('memberOfContact' => $this->_orgContactID);
$params = array('name' => 'test type', 'description' => null, 'minimum_fee' => 10, 'duration_unit' => 'year', 'period_type' => 'fixed', 'duration_interval' => 1, 'contribution_type_id' => $this->_contributionTypeId, 'relationship_type_id' => $this->_relationshipTypeId, 'visibility' => 'Public');
$membershipType = CRM_Member_BAO_MembershipType::add($params, $ids);
$this->_membershipTypeID = $membershipType->id;
$this->_mebershipStatusID = $this->membershipStatusCreate('test status');
}
示例5: civicrm_api3_membership_type_create
/**
* API to Create or update a Membership Type
*
* @param array $params an associative array of name/value property values of civicrm_membership_type
*
* @return array $result newly created or updated membership type property values.
* @access public
* {getfields MembershipType_get}
*/
function civicrm_api3_membership_type_create($params)
{
$ids['membershipType'] = CRM_Utils_Array::value('id', $params);
$ids['memberOfContact'] = CRM_Utils_Array::value('member_of_contact_id', $params);
$ids['contributionType'] = CRM_Utils_Array::value('financial_type_id', $params);
$membershipTypeBAO = CRM_Member_BAO_MembershipType::add($params, $ids);
$membershipType = array();
_civicrm_api3_object_to_array($membershipTypeBAO, $membershipType[$membershipTypeBAO->id]);
CRM_Member_PseudoConstant::membershipType(NULL, TRUE);
civicrm_api3('membership', 'getfields', array('cache_clear' => 1, 'fieldname' => 'membership_type_id'));
civicrm_api3('profile', 'getfields', array('action' => 'submit', 'cache_clear' => 1));
return civicrm_api3_create_success($membershipType, $params, 'membership_type', 'create', $membershipTypeBAO);
}
示例6: civicrm_api3_membership_type_create
/**
* API to Create or update a Membership Type
*
* @param array $params an associative array of name/value property values of civicrm_membership_type
*
* @return array $result newly created or updated membership type property values.
* @access public
* {getfields MembershipType_get}
*/
function civicrm_api3_membership_type_create($params)
{
$values = $params;
civicrm_api3_verify_mandatory($values, 'CRM_Member_DAO_MembershipType');
$ids['membershipType'] = CRM_Utils_Array::value('id', $values);
$ids['memberOfContact'] = CRM_Utils_Array::value('member_of_contact_id', $values);
$ids['contributionType'] = CRM_Utils_Array::value('contribution_type_id', $values);
require_once 'CRM/Member/BAO/MembershipType.php';
$membershipTypeBAO = CRM_Member_BAO_MembershipType::add($values, $ids);
$membershipType = array();
_civicrm_api3_object_to_array($membershipTypeBAO, $membershipType[$membershipTypeBAO->id]);
CRM_Member_PseudoConstant::membershipType(NULL, TRUE);
return civicrm_api3_create_success($membershipType, $params, 'membership_type', 'create', $membershipTypeBAO);
}
示例7: setUp
function setUp()
{
parent::setUp();
$params = array('contact_type_a' => 'Individual', 'contact_type_b' => 'Organization', 'name_a_b' => 'Test Employee of', 'name_b_a' => 'Test Employer of');
$this->_relationshipTypeId = $this->relationshipTypeCreate($params);
$this->_orgContactID = $this->organizationCreate();
$this->_financialTypeId = 1;
$this->_membershipTypeName = 'Mickey Mouse Club Member';
$params = array('name' => $this->_membershipTypeName, 'description' => NULL, 'minimum_fee' => 10, 'duration_unit' => 'year', 'member_of_contact_id' => $this->_orgContactID, 'period_type' => 'fixed', 'duration_interval' => 1, 'financial_type_id' => $this->_financialTypeId, 'relationship_type_id' => $this->_relationshipTypeId, 'visibility' => 'Public', 'is_active' => 1, 'fixed_period_start_day' => 101, 'fixed_period_rollover_day' => 1231);
$ids = array();
$membershipType = CRM_Member_BAO_MembershipType::add($params, $ids);
$this->_membershipTypeID = $membershipType->id;
$this->_mebershipStatusID = $this->membershipStatusCreate('test status');
$session = CRM_Core_Session::singleton();
$session->set('dateTypes', 1);
}
示例8: crm_create_membership_type
/**
* Create a Membership Type
*
* This API is used for creating a Membership Type
*
* @param array $params an associative array of name/value property values of civicrm_membership_type
*
* @return array of newly created membership type property values.
* @access public
*/
function crm_create_membership_type($params)
{
_crm_initialize();
if (!is_array($params)) {
return _crm_error('Params is not an array.');
}
if (!isset($params['name']) || !isset($params['duration_unit']) || !isset($params['duration_interval'])) {
return _crm_error('Missing require fileds ( name, duration unit,duration interval)');
}
$error = _crm_check_required_fields($params, 'CRM_Member_DAO_MembershipType');
if (is_a($error, 'CRM_Core_Error')) {
return $error;
}
$ids['membershipType'] = CRM_Utils_Array::value('id', $params);
$ids['memberOfContact'] = CRM_Utils_Array::value('member_of_contact_id', $params);
$ids['contributionType'] = CRM_Utils_Array::value('contribution_type_id', $params);
require_once 'CRM/Member/BAO/MembershipType.php';
$membershipTypeBAO = CRM_Member_BAO_MembershipType::add($params, $ids);
$membershipType = array();
_crm_object_to_array($membershipTypeBAO, $membershipType);
return $membershipType;
}
示例9: postProcess
/**
* Function to process the form
*
* @access public
*
* @return None
*/
public function postProcess()
{
if ($this->_action & CRM_Core_Action::DELETE) {
CRM_Utils_Weight::delWeight('CRM_Member_DAO_MembershipType', $this->_id);
CRM_Member_BAO_MembershipType::del($this->_id);
CRM_Core_Session::setStatus(ts('Selected membership type has been deleted.'));
} else {
$buttonName = $this->controller->getButtonName();
$submitted = $this->controller->exportValues($this->_name);
$this->set('searchDone', 0);
if ($buttonName == '_qf_MembershipType_refresh') {
$this->search($submitted);
$this->set('searchDone', 1);
return;
}
$fields = array('name', 'weight', 'is_active', 'member_org', 'visibility', 'period_type', 'minimum_fee', 'description', 'auto_renew', 'autorenewal_msg_id', 'duration_unit', 'renewal_msg_id', 'duration_interval', 'renewal_reminder_day', 'contribution_type_id', 'fixed_period_start_day', 'fixed_period_rollover_day');
$params = $ids = array();
foreach ($fields as $fld) {
$params[$fld] = CRM_Utils_Array::value($fld, $submitted, 'NULL');
}
//clean money.
if ($params['minimum_fee']) {
$params['minimum_fee'] = CRM_Utils_Rule::cleanMoney($params['minimum_fee']);
}
$hasRelTypeVal = FALSE;
if (!CRM_Utils_System::isNull($submitted['relationship_type_id'])) {
// To insert relation ids and directions with value separator
$relTypeDirs = $submitted['relationship_type_id'];
$relIds = $relDirection = array();
foreach ($relTypeDirs as $key => $value) {
$relationId = explode('_', $value);
if (count($relationId) == 3 && is_numeric($relationId[0])) {
$relIds[] = $relationId[0];
$relDirection[] = $relationId[1] . '_' . $relationId[2];
}
}
if (!empty($relIds)) {
$hasRelTypeVal = TRUE;
$params['relationship_type_id'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, $relIds);
$params['relationship_direction'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, $relDirection);
}
}
if (!$hasRelTypeVal) {
$params['relationship_type_id'] = $params['relationship_direction'] = 'NULL';
}
if ($params['duration_unit'] == 'lifetime' && empty($params['duration_interval'])) {
$params['duration_interval'] = 1;
}
$config = CRM_Core_Config::singleton();
$periods = array('fixed_period_start_day', 'fixed_period_rollover_day');
foreach ($periods as $per) {
if (CRM_Utils_Array::value('M', $params[$per]) && CRM_Utils_Array::value('d', $params[$per])) {
$mon = $params[$per]['M'];
$dat = $params[$per]['d'];
$mon = $mon < 9 ? '0' . $mon : $mon;
$dat = $dat < 9 ? '0' . $dat : $dat;
$params[$per] = $mon . $dat;
} else {
$params[$per] = 'NULL';
}
}
$oldWeight = NULL;
$ids['memberOfContact'] = CRM_Utils_Array::value('contact_check', $submitted);
if ($this->_id) {
$oldWeight = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $this->_id, 'weight', 'id');
}
$params['weight'] = CRM_Utils_Weight::updateOtherWeights('CRM_Member_DAO_MembershipType', $oldWeight, $params['weight']);
if ($this->_action & CRM_Core_Action::UPDATE) {
$ids['membershipType'] = $this->_id;
}
$membershipType = CRM_Member_BAO_MembershipType::add($params, $ids);
CRM_Core_Session::setStatus(ts('The membership type \'%1\' has been saved.', array(1 => $membershipType->name)));
$session = CRM_Core_Session::singleton();
if ($buttonName == $this->getButtonName('upload', 'new')) {
CRM_Core_Session::setStatus(ts(' You can add another membership type.'));
$session->replaceUserContext(CRM_Utils_System::url('civicrm/admin/member/membershipType', 'action=add&reset=1'));
}
}
}
示例10: postProcess
/**
* Process the form submission.
*
*
* @return void
*/
public function postProcess()
{
if ($this->_action & CRM_Core_Action::DELETE) {
try {
CRM_Member_BAO_MembershipType::del($this->_id);
} catch (CRM_Core_Exception $e) {
CRM_Core_Error::statusBounce($e->getMessage(), NULL, ts('Membership Type Not Deleted'));
}
CRM_Core_Session::setStatus(ts('Selected membership type has been deleted.'), ts('Record Deleted'), 'success');
} else {
$buttonName = $this->controller->getButtonName();
$submitted = $this->controller->exportValues($this->_name);
$fields = array('name', 'weight', 'is_active', 'member_of_contact_id', 'visibility', 'period_type', 'minimum_fee', 'description', 'auto_renew', 'duration_unit', 'duration_interval', 'financial_type_id', 'fixed_period_start_day', 'fixed_period_rollover_day', 'month_fixed_period_rollover_day', 'max_related');
$params = $ids = array();
foreach ($fields as $fld) {
$params[$fld] = CRM_Utils_Array::value($fld, $submitted, 'NULL');
}
//clean money.
if ($params['minimum_fee']) {
$params['minimum_fee'] = CRM_Utils_Rule::cleanMoney($params['minimum_fee']);
}
$hasRelTypeVal = FALSE;
if (!CRM_Utils_System::isNull($submitted['relationship_type_id'])) {
// To insert relation ids and directions with value separator
$relTypeDirs = $submitted['relationship_type_id'];
$relIds = $relDirection = array();
foreach ($relTypeDirs as $key => $value) {
$relationId = explode('_', $value);
if (count($relationId) == 3 && is_numeric($relationId[0])) {
$relIds[] = $relationId[0];
$relDirection[] = $relationId[1] . '_' . $relationId[2];
}
}
if (!empty($relIds)) {
$hasRelTypeVal = TRUE;
$params['relationship_type_id'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, $relIds);
$params['relationship_direction'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, $relDirection);
}
}
if (!$hasRelTypeVal) {
$params['relationship_type_id'] = $params['relationship_direction'] = $params['max_related'] = 'NULL';
}
if ($params['duration_unit'] == 'lifetime' && empty($params['duration_interval'])) {
$params['duration_interval'] = 1;
}
$periods = array('fixed_period_start_day', 'fixed_period_rollover_day');
foreach ($periods as $per) {
if (!empty($params[$per]['M']) && !empty($params[$per]['d'])) {
$mon = $params[$per]['M'];
$dat = $params[$per]['d'];
$mon = $mon < 10 ? '0' . $mon : $mon;
$dat = $dat < 10 ? '0' . $dat : $dat;
$params[$per] = $mon . $dat;
} elseif ($per == 'fixed_period_rollover_day' && !empty($params['month_fixed_period_rollover_day'])) {
$params['fixed_period_rollover_day'] = $params['month_fixed_period_rollover_day']['d'];
unset($params['month_fixed_period_rollover_day']);
} else {
$params[$per] = 'NULL';
}
}
$oldWeight = NULL;
if ($this->_id) {
$oldWeight = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $this->_id, 'weight', 'id');
}
$params['weight'] = CRM_Utils_Weight::updateOtherWeights('CRM_Member_DAO_MembershipType', $oldWeight, $params['weight']);
if ($this->_action & CRM_Core_Action::UPDATE) {
$ids['membershipType'] = $this->_id;
}
$membershipType = CRM_Member_BAO_MembershipType::add($params, $ids);
CRM_Core_Session::setStatus(ts('The membership type \'%1\' has been saved.', array(1 => $membershipType->name)), ts('Saved'), 'success');
$session = CRM_Core_Session::singleton();
if ($buttonName == $this->getButtonName('upload', 'new')) {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/admin/member/membershipType/add', 'action=add&reset=1'));
}
}
}
示例11: testGetMembershipTypesByOrg
/**
* check function getMembershipTypesByOrg( )
*
*/
public function testGetMembershipTypesByOrg()
{
$ids = array();
$params = array('name' => 'General', 'description' => NULL, 'domain_id' => 1, 'minimum_fee' => 100, 'duration_unit' => 'year', 'member_of_contact_id' => $this->_orgContactID, 'period_type' => 'rolling', 'duration_interval' => 1, 'financial_type_id' => $this->_financialTypeId, 'relationship_type_id' => $this->_relationshipTypeId, 'visibility' => 'Public', 'is_active' => 1);
$membershipType = CRM_Member_BAO_MembershipType::add($params, $ids);
$result = CRM_Member_BAO_MembershipType::getMembershipTypesByOrg($this->_orgContactID);
$this->assertEquals(empty($result), FALSE, 'Verify membership types for organization.');
$result = CRM_Member_BAO_MembershipType::getMembershipTypesByOrg(501);
$this->assertEquals(empty($result), TRUE, 'Verify membership types for organization.');
$this->membershipTypeDelete(array('id' => $membershipType->id));
}
示例12: postProcess
/**
* Function to process the form
*
* @access public
* @return None
*/
public function postProcess()
{
require_once 'CRM/Member/BAO/MembershipType.php';
if ($this->_action & CRM_Core_Action::DELETE) {
$wt = CRM_Utils_Weight::delWeight('CRM_Member_DAO_MembershipType', $this->_id);
CRM_Member_BAO_MembershipType::del($this->_id);
CRM_Core_Session::setStatus(ts('Selected membership type has been deleted.'));
} else {
$params = $ids = array();
$params = $this->exportValues();
$this->set('searchDone', 0);
if (CRM_Utils_Array::value('_qf_MembershipType_refresh', $_POST)) {
$this->search($params);
$this->set('searchDone', 1);
return;
}
$params['minimum_fee'] = CRM_Utils_Rule::cleanMoney($params['minimum_fee']);
if (CRM_Utils_Array::value('relationship_type_id', $params)) {
$relationId = explode('_', $params['relationship_type_id']);
$params['relationship_type_id'] = $relationId[0];
$params['relationship_direction'] = $relationId[1] . '_' . $relationId[2];
}
if ($this->_action & CRM_Core_Action::UPDATE) {
$ids['membershipType'] = $this->_id;
}
if ($params['duration_unit'] == 'lifetime' and empty($params['duration_interval'])) {
$params['duration_interval'] = 1;
}
$config =& CRM_Core_Config::singleton();
$periods = array('fixed_period_start_day', 'fixed_period_rollover_day');
foreach ($periods as $per) {
if ($params[$per][$config->dateformatMonthVar] && $params[$per]['d']) {
$mon = $params[$per][$config->dateformatMonthVar];
$dat = $params[$per]['d'];
$mon = $mon < 9 ? '0' . $mon : $mon;
$dat = $dat < 9 ? '0' . $dat : $dat;
$params[$per] = $mon . $dat;
} else {
$params[$per] = 'null';
}
}
$oldWeight = null;
$ids['memberOfContact'] = CRM_Utils_Array::value('contact_check', $params);
if ($this->_id) {
$oldWeight = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $this->_id, 'weight', 'id');
}
$params['weight'] = CRM_Utils_Weight::updateOtherWeights('CRM_Member_DAO_MembershipType', $oldWeight, $params['weight']);
$membershipType = CRM_Member_BAO_MembershipType::add($params, $ids);
CRM_Core_Session::setStatus(ts('The membership type \'%1\' has been saved.', array(1 => $membershipType->name)));
}
}
示例13: testValidateTogglingDeferredRevenue
/**
* Test Validate if Deferred Account is set for Financial Type.
*/
public function testValidateTogglingDeferredRevenue()
{
$orgContactID = $this->organizationCreate();
//create relationship
$params = array('name_a_b' => 'Relation 1', 'name_b_a' => 'Relation 2', 'contact_type_a' => 'Individual', 'contact_type_b' => 'Organization', 'is_reserved' => 1, 'is_active' => 1);
$relationshipTypeId = $this->relationshipTypeCreate($params);
$ids = array();
$params = array('name' => 'test type', 'domain_id' => 1, 'description' => NULL, 'minimum_fee' => 10, 'duration_unit' => 'year', 'member_of_contact_id' => $orgContactID, 'relationship_type_id' => $relationshipTypeId, 'period_type' => 'fixed', 'duration_interval' => 1, 'financial_type_id' => 1, 'visibility' => 'Public', 'is_active' => 1);
$membershipType = CRM_Member_BAO_MembershipType::add($params, $ids);
$membership = $this->assertDBNotNull('CRM_Member_BAO_MembershipType', $orgContactID, 'name', 'member_of_contact_id', 'Database check on updated membership record.');
$error = CRM_Financial_BAO_FinancialAccount::validateTogglingDeferredRevenue();
$this->assertTrue(!empty($error), "Error message did not appear");
$this->membershipTypeDelete(array('id' => $membershipType->id));
}
示例14: testGetMembershipTypesByOrg
function testGetMembershipTypesByOrg()
{
$ids = array('memberOfContact' => $this->_orgContactID);
$params = array('name' => 'General', 'description' => null, 'minimum_fee' => 100, 'duration_unit' => 'year', 'period_type' => 'rolling', 'duration_interval' => 1, 'contribution_type_id' => $this->_contributionTypeId, 'relationship_type_id' => $this->_relationshipTypeId, 'visibility' => 'Public', 'is_active' => 1);
$membershipType = CRM_Member_BAO_MembershipType::add($params, $ids);
$result = CRM_Member_BAO_MembershipType::getMembershipTypesByOrg($this->_orgContactID);
$this->assertEquals(empty($result), false, 'Verify membership types for organization.');
$result = CRM_Member_BAO_MembershipType::getMembershipTypesByOrg(501);
$this->assertEquals(empty($result), true, 'Verify membership types for organization.');
}
示例15: testgetAvailableMembershipTypes
/**
* Check method testgetAvailableMembershipTypes()
*/
public function testgetAvailableMembershipTypes()
{
// Create Membership types
$ids = array();
$params = array('name' => 'Type One', 'domain_id' => 1, 'minimum_fee' => 10, 'duration_unit' => 'year', 'member_of_contact_id' => $this->_orgContactID, 'period_type' => 'fixed', 'duration_interval' => 1, 'financial_type_id' => 1, 'visibility' => 'Public', 'is_active' => 1);
$membershipType = CRM_Member_BAO_MembershipType::add($params, $ids);
// Add another
$params['name'] = 'Type Two';
$params['financial_type_id'] = 2;
$membershipType = CRM_Member_BAO_MembershipType::add($params, $ids);
$this->setACL();
$this->setPermissions(array('view contributions of type Donation', 'view contributions of type Member Dues'));
CRM_Financial_BAO_FinancialType::getAvailableMembershipTypes($types);
$expectedResult = array(1 => "Type One", 2 => "Type Two");
$this->assertEquals($expectedResult, $types, 'Verify that only certain membership types can be retrieved');
$this->setPermissions(array('view contributions of type Donation'));
unset($expectedResult[2]);
CRM_Financial_BAO_FinancialType::getAvailableMembershipTypes($types);
$this->assertEquals($expectedResult, $types, 'Verify that removing permission for a financial type restricts the available membership types');
}