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