3 * Test Generated example of using membership_type create API
6 function membership_type_create_example(){
8 'name' => '40+ Membership',
9 'description' => 'people above 40 are given health instructions',
10 'member_of_contact_id' => 1,
11 'financial_type_id' => 1,
13 'minimum_fee' => '200',
14 'duration_unit' => 'month',
15 'duration_interval' => '10',
16 'period_type' => 'rolling',
17 'visibility' => 'public',
21 $result = civicrm_api3('membership_type', 'create', $params);
23 catch (CiviCRM_API3_Exception
$e) {
25 $errorMessage = $e->getMessage();
26 $errorCode = $e->getErrorCode();
27 $errorData = $e->getExtraParams();
28 return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
35 * Function returns array of result expected from previous function
37 function membership_type_create_expectedresult(){
39 $expectedResult = array(
48 'name' => '40+ Membership',
49 'description' => 'people above 40 are given health instructions',
50 'member_of_contact_id' => '1',
51 'financial_type_id' => '1',
52 'minimum_fee' => '200',
53 'duration_unit' => 'month',
54 'duration_interval' => '10',
55 'period_type' => 'rolling',
56 'fixed_period_start_day' => '',
57 'fixed_period_rollover_day' => '',
58 'relationship_type_id' => '',
59 'relationship_direction' => '',
61 'visibility' => 'Public',
63 'receipt_text_signup' => '',
64 'receipt_text_renewal' => '',
67 'contribution_type_id' => '1',
72 return $expectedResult;
77 * This example has been generated from the API test suite. The test that created it is called
79 * testCreate and can be found in
80 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTypeTest.php
82 * You can see the outcome of the API tests at
83 * https://test.civicrm.org/job/CiviCRM-master-git/
85 * To Learn about the API read
86 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
88 * Browse the api on your own site with the api explorer
89 * http://MYSITE.ORG/path/to/civicrm/api/explorer
91 * Read more about testing here
92 * http://wiki.civicrm.org/confluence/display/CRM/Testing
94 * API Standards documentation:
95 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards