infra updated incorrectly set public functions to private on payment classes
[civicrm-core.git] / api / v3 / examples / Activity / ContactRefCustomField.php
1 <?php
2 /**
3 * @file
4 * Test Generated API Example.
5 * See bottom of this file for more detail.
6 */
7
8 /**
9 * Test Generated example of using activity Create API.
10 *
11 * demonstrates create with Contact Reference Custom Field
12 *
13 * @return array
14 * API result array
15 */
16 function activity_create_example() {
17 $params = array(
18 'source_contact_id' => 1,
19 'activity_type_id' => '51',
20 'subject' => 'test activity type id',
21 'activity_date_time' => '2011-06-02 14:36:13',
22 'status_id' => 2,
23 'priority_id' => 1,
24 'duration' => 120,
25 'location' => 'Pensulvania',
26 'details' => 'a test activity',
27 'custom_2' => '1',
28 );
29
30 try{
31 $result = civicrm_api3('activity', 'Create', $params);
32 }
33 catch (CiviCRM_API3_Exception $e) {
34 // Handle error here.
35 $errorMessage = $e->getMessage();
36 $errorCode = $e->getErrorCode();
37 $errorData = $e->getExtraParams();
38 return array(
39 'error' => $errorMessage,
40 'error_code' => $errorCode,
41 'error_data' => $errorData,
42 );
43 }
44
45 return $result;
46 }
47
48 /**
49 * Function returns array of result expected from previous function.
50 *
51 * @return array
52 * API result array
53 */
54 function activity_create_expectedresult() {
55
56 $expectedResult = array(
57 'is_error' => 0,
58 'version' => 3,
59 'count' => 1,
60 'id' => 1,
61 'values' => array(
62 '1' => array(
63 'id' => '1',
64 'source_record_id' => '',
65 'activity_type_id' => '51',
66 'subject' => 'test activity type id',
67 'activity_date_time' => '20110602143613',
68 'duration' => '120',
69 'location' => 'Pensulvania',
70 'phone_id' => '',
71 'phone_number' => '',
72 'details' => 'a test activity',
73 'status_id' => '2',
74 'priority_id' => '1',
75 'parent_id' => '',
76 'is_test' => '',
77 'medium_id' => '',
78 'is_auto' => '',
79 'relationship_id' => '',
80 'is_current_revision' => '',
81 'original_id' => '',
82 'result' => '',
83 'is_deleted' => '',
84 'campaign_id' => '',
85 'engagement_level' => '',
86 'weight' => '',
87 ),
88 ),
89 );
90
91 return $expectedResult;
92 }
93
94 /**
95 * This example has been generated from the API test suite.
96 * The test that created it is called
97 * testActivityCreateCustomContactRefField
98 * and can be found in
99 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php
100 *
101 * You can see the outcome of the API tests at
102 * https://test.civicrm.org/job/CiviCRM-master-git/
103 *
104 * To Learn about the API read
105 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
106 *
107 * Browse the api on your own site with the api explorer
108 * http://MYSITE.ORG/path/to/civicrm/api/explorer
109 *
110 * Read more about testing here
111 * http://wiki.civicrm.org/confluence/display/CRM/Testing
112 *
113 * API Standards documentation:
114 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
115 */