3 * Test Generated example of using membership_type create API.
9 function membership_type_create_example() {
11 'name' => '40+ Membership',
12 'description' => 'people above 40 are given health instructions',
13 'member_of_contact_id' => 13,
14 'financial_type_id' => 1,
16 'minimum_fee' => '200',
17 'duration_unit' => 'month',
18 'duration_interval' => '10',
19 'period_type' => 'rolling',
20 'visibility' => 'public',
24 $result = civicrm_api3('membership_type', 'create', $params);
26 catch (CiviCRM_API3_Exception
$e) {
28 $errorMessage = $e->getMessage();
29 $errorCode = $e->getErrorCode();
30 $errorData = $e->getExtraParams();
32 'error' => $errorMessage,
33 'error_code' => $errorCode,
34 'error_data' => $errorData,
42 * Function returns array of result expected from previous function.
47 function membership_type_create_expectedresult() {
49 $expectedResult = array(
58 'name' => '40+ Membership',
59 'description' => 'people above 40 are given health instructions',
60 'member_of_contact_id' => '13',
61 'financial_type_id' => '1',
62 'minimum_fee' => '200',
63 'duration_unit' => 'month',
64 'duration_interval' => '10',
65 'period_type' => 'rolling',
66 'fixed_period_start_day' => '',
67 'fixed_period_rollover_day' => '',
68 'relationship_type_id' => '',
69 'relationship_direction' => '',
71 'visibility' => 'Public',
73 'receipt_text_signup' => '',
74 'receipt_text_renewal' => '',
77 'contribution_type_id' => '1',
82 return $expectedResult;
86 * This example has been generated from the API test suite.
87 * The test that created it is called
90 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTypeTest.php
92 * You can see the outcome of the API tests at
93 * https://test.civicrm.org/job/CiviCRM-master-git/
95 * To Learn about the API read
96 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
98 * Browse the api on your own site with the api explorer
99 * http://MYSITE.ORG/path/to/civicrm/api
101 * Read more about testing here
102 * http://wiki.civicrm.org/confluence/display/CRM/Testing
104 * API Standards documentation:
105 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards