3 * Test Generated example demonstrating the Membership.get API.
5 * Demonstrates use of 'filter' active_only' param.
10 function membership_get_example() {
19 $result = civicrm_api3('Membership', 'get', $params);
21 catch (CiviCRM_API3_Exception
$e) {
23 $errorMessage = $e->getMessage();
24 $errorCode = $e->getErrorCode();
25 $errorData = $e->getExtraParams();
27 'error' => $errorMessage,
28 'error_code' => $errorCode,
29 'error_data' => $errorData,
37 * Function returns array of result expected from previous function.
42 function membership_get_expectedresult() {
44 $expectedResult = array(
53 'membership_type_id' => '27',
54 'join_date' => '2009-01-21',
55 'start_date' => '2013-07-29 00:00:00',
56 'end_date' => '2013-08-04 00:00:00',
57 'source' => 'Payment',
62 'membership_name' => 'General',
63 'relationship_name' => 'Child of',
68 return $expectedResult;
72 * This example has been generated from the API test suite.
73 * The test that created it is called "testGetOnlyActive"
74 * and can be found at:
75 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTest.php
77 * You can see the outcome of the API tests at
78 * https://test.civicrm.org/job/CiviCRM-master-git/
80 * To Learn about the API read
81 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
83 * Browse the api on your own site with the api explorer
84 * http://MYSITE.ORG/path/to/civicrm/api
86 * Read more about testing here
87 * http://wiki.civicrm.org/confluence/display/CRM/Testing
89 * API Standards documentation:
90 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards