4 * Test Generated API Example.
5 * See bottom of this file for more detail.
9 * Test Generated example of using membership_type create API.
15 function membership_type_create_example() {
17 'name' => '40+ Membership',
18 'description' => 'people above 40 are given health instructions',
19 'member_of_contact_id' => 13,
20 'financial_type_id' => 1,
22 'minimum_fee' => '200',
23 'duration_unit' => 'month',
24 'duration_interval' => '10',
25 'period_type' => 'rolling',
26 'visibility' => 'public',
30 $result = civicrm_api3('membership_type', 'create', $params);
32 catch (CiviCRM_API3_Exception
$e) {
34 $errorMessage = $e->getMessage();
35 $errorCode = $e->getErrorCode();
36 $errorData = $e->getExtraParams();
38 'error' => $errorMessage,
39 'error_code' => $errorCode,
40 'error_data' => $errorData,
48 * Function returns array of result expected from previous function.
53 function membership_type_create_expectedresult() {
55 $expectedResult = array(
64 'name' => '40+ Membership',
65 'description' => 'people above 40 are given health instructions',
66 'member_of_contact_id' => '13',
67 'financial_type_id' => '1',
68 'minimum_fee' => '200',
69 'duration_unit' => 'month',
70 'duration_interval' => '10',
71 'period_type' => 'rolling',
72 'fixed_period_start_day' => '',
73 'fixed_period_rollover_day' => '',
74 'relationship_type_id' => '',
75 'relationship_direction' => '',
77 'visibility' => 'Public',
79 'receipt_text_signup' => '',
80 'receipt_text_renewal' => '',
83 'contribution_type_id' => '1',
88 return $expectedResult;
92 * This example has been generated from the API test suite.
93 * The test that created it is called
96 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTypeTest.php
98 * You can see the outcome of the API tests at
99 * https://test.civicrm.org/job/CiviCRM-master-git/
101 * To Learn about the API read
102 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
104 * Browse the api on your own site with the api explorer
105 * http://MYSITE.ORG/path/to/civicrm/api/explorer
107 * Read more about testing here
108 * http://wiki.civicrm.org/confluence/display/CRM/Testing
110 * API Standards documentation:
111 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards