3 * Test Generated example demonstrating the Membership.create API.
8 function membership_create_example() {
11 'membership_type_id' => 57,
12 'join_date' => '2009-01-21',
13 'start_date' => '2009-01-21',
14 'end_date' => '2009-12-21',
15 'source' => 'Payment',
21 $result = civicrm_api3('Membership', 'create', $params);
23 catch (CiviCRM_API3_Exception
$e) {
25 $errorMessage = $e->getMessage();
26 $errorCode = $e->getErrorCode();
27 $errorData = $e->getExtraParams();
30 'error_message' => $errorMessage,
31 'error_code' => $errorCode,
32 'error_data' => $errorData,
40 * Function returns array of result expected from previous function.
45 function membership_create_expectedresult() {
47 $expectedResult = array(
56 'membership_type_id' => '57',
57 'join_date' => '20090121000000',
58 'start_date' => '2013-07-29 00:00:00',
59 'end_date' => '2013-08-04 00:00:00',
60 'source' => 'Payment',
63 'owner_membership_id' => '',
67 'contribution_recur_id' => '',
73 return $expectedResult;
77 * This example has been generated from the API test suite.
78 * The test that created it is called "testSearchWithCustomDataCRM16036"
79 * and can be found at:
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
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