3 * Test Generated example of using membership get API
4 * Demonstrates use of 'filter' active_only' param *
6 function membership_get_example(){
15 $result = civicrm_api3('membership', 'get', $params);
17 catch (CiviCRM_API3_Exception
$e) {
19 $errorMessage = $e->getMessage();
20 $errorCode = $e->getErrorCode();
21 $errorData = $e->getExtraParams();
22 return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
29 * Function returns array of result expected from previous function
31 function membership_get_expectedresult(){
33 $expectedResult = array(
42 'membership_type_id' => '27',
43 'join_date' => '2009-01-21',
44 'start_date' => '2013-07-29 00:00:00',
45 'end_date' => '2013-08-04 00:00:00',
46 'source' => 'Payment',
51 'membership_name' => 'General',
52 'relationship_name' => 'Child of',
57 return $expectedResult;
62 * This example has been generated from the API test suite. The test that created it is called
64 * testGetOnlyActive and can be found in
65 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTest.php
67 * You can see the outcome of the API tests at
68 * https://test.civicrm.org/job/CiviCRM-master-git/
70 * To Learn about the API read
71 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
73 * Browse the api on your own site with the api explorer
74 * http://MYSITE.ORG/path/to/civicrm/api/explorer
76 * Read more about testing here
77 * http://wiki.civicrm.org/confluence/display/CRM/Testing
79 * API Standards documentation:
80 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards