3 * Test Generated example of using activity API.
5 * Example demonstrates setting & retrieving the target & source
10 function activity__example() {
12 'source_contact_id' => 1,
13 'subject' => 'Make-it-Happen Meeting',
14 'activity_date_time' => '20110316',
16 'location' => 'Pennsylvania',
17 'details' => 'a test activity',
19 'activity_type_id' => 1,
21 'target_contact_id' => 1,
22 'assignee_contact_id' => 1,
26 $result = civicrm_api3('activity', '', $params);
28 catch (CiviCRM_API3_Exception
$e) {
30 $errorMessage = $e->getMessage();
31 $errorCode = $e->getErrorCode();
32 $errorData = $e->getExtraParams();
34 'error' => $errorMessage,
35 'error_code' => $errorCode,
36 'error_data' => $errorData,
44 * Function returns array of result expected from previous function.
49 function activity__expectedresult() {
51 $expectedResult = array(
59 'source_record_id' => '',
60 'activity_type_id' => '1',
61 'subject' => 'Make-it-Happen Meeting',
62 'activity_date_time' => '20110316000000',
64 'location' => 'Pennsylvania',
67 'details' => 'a test activity',
74 'relationship_id' => '',
75 'is_current_revision' => '',
80 'engagement_level' => '',
86 return $expectedResult;
90 * This example has been generated from the API test suite.
91 * The test that created it is called
92 * testActivityReturnTargetAssignee
94 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php
96 * You can see the outcome of the API tests at
97 * https://test.civicrm.org/job/CiviCRM-master-git/
99 * To Learn about the API read
100 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
102 * Browse the api on your own site with the api explorer
103 * http://MYSITE.ORG/path/to/civicrm/api
105 * Read more about testing here
106 * http://wiki.civicrm.org/confluence/display/CRM/Testing
108 * API Standards documentation:
109 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards