3 * Test Generated example of using membership update API.
9 function membership_update_example() {
12 'membership_type_id' => 65,
13 'join_date' => '2009-01-21',
14 'start_date' => '2009-01-21',
15 'end_date' => '2009-12-21',
16 'source' => 'Payment',
19 'custom_1' => 'custom string',
23 $result = civicrm_api3('membership', 'update', $params);
25 catch (CiviCRM_API3_Exception
$e) {
27 $errorMessage = $e->getMessage();
28 $errorCode = $e->getErrorCode();
29 $errorData = $e->getExtraParams();
31 'error' => $errorMessage,
32 'error_code' => $errorCode,
33 'error_data' => $errorData,
41 * Function returns array of result expected from previous function.
46 function membership_update_expectedresult() {
48 $expectedResult = array(
56 'contact_id' => '106',
57 'membership_type_id' => '65',
58 'join_date' => '20090121000000',
59 'start_date' => '2013-07-29 00:00:00',
60 'end_date' => '2013-08-04 00:00:00',
61 'source' => 'Payment',
64 'owner_membership_id' => '',
68 'contribution_recur_id' => '',
74 return $expectedResult;
78 * This example has been generated from the API test suite.
79 * The test that created it is called
80 * testUpdateWithCustom
82 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTest.php
84 * You can see the outcome of the API tests at
85 * https://test.civicrm.org/job/CiviCRM-master-git/
87 * To Learn about the API read
88 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
90 * Browse the api on your own site with the api explorer
91 * http://MYSITE.ORG/path/to/civicrm/api
93 * Read more about testing here
94 * http://wiki.civicrm.org/confluence/display/CRM/Testing
96 * API Standards documentation:
97 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards