infra updated incorrectly set public functions to private on payment classes
[civicrm-core.git] / api / v3 / examples / Membership / Update.php
CommitLineData
6a488035 1<?php
fb32de45 2/**
50fb255d 3 * @file
4 * Test Generated API Example.
5 * See bottom of this file for more detail.
6a488035 6 */
6a488035 7
50fb255d 8/**
9 * Test Generated example of using membership update API.
10 *
11 *
12 * @return array
13 * API result array
14 */
15function membership_update_example() {
16 $params = array(
17 'contact_id' => 106,
18 'membership_type_id' => 65,
19 'join_date' => '2009-01-21',
20 'start_date' => '2009-01-21',
21 'end_date' => '2009-12-21',
22 'source' => 'Payment',
23 'is_override' => 1,
24 'status_id' => 39,
25 'custom_1' => 'custom string',
26 );
6a488035 27
50fb255d 28 try{
29 $result = civicrm_api3('membership', 'update', $params);
30 }
31 catch (CiviCRM_API3_Exception $e) {
32 // Handle error here.
33 $errorMessage = $e->getMessage();
34 $errorCode = $e->getErrorCode();
35 $errorData = $e->getExtraParams();
36 return array(
37 'error' => $errorMessage,
38 'error_code' => $errorCode,
39 'error_data' => $errorData,
40 );
41 }
42
43 return $result;
6a488035
TO
44}
45
fb32de45 46/**
50fb255d 47 * Function returns array of result expected from previous function.
48 *
49 * @return array
50 * API result array
6a488035 51 */
50fb255d 52function membership_update_expectedresult() {
6a488035 53
53ca8fd7 54 $expectedResult = array(
50fb255d 55 'is_error' => 0,
56 'version' => 3,
57 'count' => 1,
58 'id' => 1,
59 'values' => array(
53ca8fd7 60 '1' => array(
50fb255d 61 'id' => '1',
62 'contact_id' => '106',
63 'membership_type_id' => '65',
64 'join_date' => '20090121000000',
65 'start_date' => '2013-07-29 00:00:00',
66 'end_date' => '2013-08-04 00:00:00',
67 'source' => 'Payment',
68 'status_id' => '39',
69 'is_override' => '1',
70 'owner_membership_id' => '',
71 'max_related' => '',
72 'is_test' => 0,
73 'is_pay_later' => '',
74 'contribution_recur_id' => '',
75 'campaign_id' => '',
76 ),
6a488035 77 ),
50fb255d 78 );
6a488035 79
fb32de45 80 return $expectedResult;
6a488035
TO
81}
82
50fb255d 83/**
84* This example has been generated from the API test suite.
85* The test that created it is called
86* testUpdateWithCustom
87* and can be found in
69d79249 88* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTest.php
6a488035
TO
89*
90* You can see the outcome of the API tests at
69d79249 91* https://test.civicrm.org/job/CiviCRM-master-git/
6a488035
TO
92*
93* To Learn about the API read
69d79249 94* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
6a488035 95*
69d79249
E
96* Browse the api on your own site with the api explorer
97* http://MYSITE.ORG/path/to/civicrm/api/explorer
6a488035
TO
98*
99* Read more about testing here
100* http://wiki.civicrm.org/confluence/display/CRM/Testing
101*
102* API Standards documentation:
103* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
b259a4ab 104*/