9fb931ea1886c688ab5f29ebce73172372ab03f3
3 * Test Generated example of using activity create API.
8 function activity_create_example() {
10 'source_contact_id' => 1,
11 'activity_type_id' => '51',
12 'subject' => 'test activity type id',
13 'activity_date_time' => '2011-06-02 14:36:13',
17 'location' => 'Pennsylvania',
18 'details' => 'a test activity',
19 'custom_1' => 'custom string',
23 $result = civicrm_api3('activity', 'create', $params);
25 catch (CiviCRM_API3_Exception
$e) {
27 $errorMessage = $e->getMessage();
28 $errorCode = $e->getErrorCode();
29 $errorData = $e->getExtraParams();
31 'error' => $errorMessage,
32 'error_code' => $errorCode,
33 'error_data' => $errorData,
41 * Function returns array of result expected from previous function.
46 function activity_create_expectedresult() {
48 $expectedResult = array(
56 'source_record_id' => '',
57 'activity_type_id' => '51',
58 'subject' => 'test activity type id',
59 'activity_date_time' => '20110602143613',
61 'location' => 'Pennsylvania',
64 'details' => 'a test activity',
71 'relationship_id' => '',
72 'is_current_revision' => '',
77 'engagement_level' => '',
83 return $expectedResult;
87 * This example has been generated from the API test suite.
88 * The test that created it is called
89 * testActivityCreateCustom
91 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php
93 * You can see the outcome of the API tests at
94 * https://test.civicrm.org/job/CiviCRM-master-git/
96 * To Learn about the API read
97 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
99 * Browse the api on your own site with the api explorer
100 * http://MYSITE.ORG/path/to/civicrm/api
102 * Read more about testing here
103 * http://wiki.civicrm.org/confluence/display/CRM/Testing
105 * API Standards documentation:
106 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards