3 * Test Generated example demonstrating the Membership.get API.
8 function membership_get_example() {
10 'membership_type_id' => 21,
14 $result = civicrm_api3('Membership', 'get', $params);
16 catch (CiviCRM_API3_Exception
$e) {
18 $errorMessage = $e->getMessage();
19 $errorCode = $e->getErrorCode();
20 $errorData = $e->getExtraParams();
22 'error' => $errorMessage,
23 'error_code' => $errorCode,
24 'error_data' => $errorData,
32 * Function returns array of result expected from previous function.
37 function membership_get_expectedresult() {
39 $expectedResult = array(
48 'membership_type_id' => '21',
49 'join_date' => '2009-01-21',
50 'start_date' => '2013-07-29 00:00:00',
51 'end_date' => '2013-08-04 00:00:00',
52 'source' => 'Payment',
57 'membership_name' => 'General',
58 'relationship_name' => 'Child of',
59 'custom_1' => 'custom string',
60 'custom_1_1' => 'custom string',
65 return $expectedResult;
69 * This example has been generated from the API test suite.
70 * The test that created it is called "testGetWithParamsMemberShipIdAndCustom"
71 * and can be found at:
72 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTest.php
74 * You can see the outcome of the API tests at
75 * https://test.civicrm.org/job/CiviCRM-master-git/
77 * To Learn about the API read
78 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
80 * Browse the api on your own site with the api explorer
81 * http://MYSITE.ORG/path/to/civicrm/api
83 * Read more about testing here
84 * http://wiki.civicrm.org/confluence/display/CRM/Testing
86 * API Standards documentation:
87 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards