3 * Test Generated example of using activity get API
4 * Function demonstrates getting asignee_contact_id & using it to get the contact *
6 function activity_get_example(){
10 'return.assignee_contact_id' => 1,
11 'api.contact.get' => array(
12 'id' => '$value.source_contact_id',
17 $result = civicrm_api3('activity', 'get', $params);
19 catch (CiviCRM_API3_Exception
$e) {
21 $errorMessage = $e->getMessage();
22 $errorCode = $e->getErrorCode();
23 $errorData = $e->getExtraParams();
24 return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
31 * Function returns array of result expected from previous function
33 function activity_get_expectedresult(){
35 $expectedResult = array(
43 'activity_type_id' => '46',
44 'subject' => 'test activity type id',
45 'activity_date_time' => '2011-06-02 14:36:13',
47 'location' => 'Pensulvania',
48 'details' => 'a test activity',
53 'is_current_revision' => '1',
55 'assignee_contact_id' => array(
58 'source_contact_id' => '17',
59 'api.contact.get' => array(
67 'contact_type' => 'Individual',
68 'contact_sub_type' => '',
70 'display_name' => 'Test Contact',
77 'legal_identifier' => '',
78 'external_identifier' => '',
82 'preferred_mail_format' => '',
83 'first_name' => 'Test',
85 'last_name' => 'Contact',
89 'deceased_date' => '',
90 'household_name' => '',
91 'organization_name' => '',
93 'contact_is_deleted' => 0,
94 'current_employer' => '',
96 'street_address' => '',
97 'supplemental_address_1' => '',
98 'supplemental_address_2' => '',
100 'postal_code_suffix' => '',
104 'state_province_id' => '',
105 'state_province_name' => '',
106 'state_province' => '',
110 'phone_type_id' => '',
118 'worldregion_id' => '',
119 'world_region' => '',
128 return $expectedResult;
133 * This example has been generated from the API test suite. The test that created it is called
135 * testActivityGetGoodID1 and can be found in
136 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/ActivityTest.php
138 * You can see the outcome of the API tests at
139 * http://tests.dev.civicrm.org/trunk/results-api_v3
141 * To Learn about the API read
142 * http://book.civicrm.org/developer/current/techniques/api/
144 * and review the wiki at
145 * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
147 * Read more about testing here
148 * http://wiki.civicrm.org/confluence/display/CRM/Testing
150 * API Standards documentation:
151 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards