4 * Test Generated API Example.
5 * See bottom of this file for more detail.
9 * Test Generated example of using membership get API.
15 function membership_get_example() {
17 'membership_type_id' => 21,
21 $result = civicrm_api3('membership', 'get', $params);
23 catch (CiviCRM_API3_Exception
$e) {
25 $errorMessage = $e->getMessage();
26 $errorCode = $e->getErrorCode();
27 $errorData = $e->getExtraParams();
29 'error' => $errorMessage,
30 'error_code' => $errorCode,
31 'error_data' => $errorData,
39 * Function returns array of result expected from previous function.
44 function membership_get_expectedresult() {
46 $expectedResult = array(
55 'membership_type_id' => '21',
56 'join_date' => '2009-01-21',
57 'start_date' => '2013-07-29 00:00:00',
58 'end_date' => '2013-08-04 00:00:00',
59 'source' => 'Payment',
64 'membership_name' => 'General',
65 'relationship_name' => 'Child of',
66 'custom_1' => 'custom string',
67 'custom_1_1' => 'custom string',
72 return $expectedResult;
76 * This example has been generated from the API test suite.
77 * The test that created it is called
78 * testGetWithParamsMemberShipIdAndCustom
80 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTest.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