Consolidate handling of greeting label
[civicrm-core.git] / api / v3 / examples / Activity / DateTimeLow.php
1 <?php
2 /**
3 * Test Generated example demonstrating the Activity.get API.
4 *
5 * Demonstrates _low filter (at time of writing doesn't work if contact_id is set.
6 *
7 * @return array
8 * API result array
9 */
10 function activity_get_example() {
11 $params = [
12 'filter.activity_date_time_low' => '20120101000000',
13 'sequential' => 1,
14 ];
15
16 try{
17 $result = civicrm_api3('Activity', 'get', $params);
18 }
19 catch (CiviCRM_API3_Exception $e) {
20 // Handle error here.
21 $errorMessage = $e->getMessage();
22 $errorCode = $e->getErrorCode();
23 $errorData = $e->getExtraParams();
24 return [
25 'is_error' => 1,
26 'error_message' => $errorMessage,
27 'error_code' => $errorCode,
28 'error_data' => $errorData,
29 ];
30 }
31
32 return $result;
33 }
34
35 /**
36 * Function returns array of result expected from previous function.
37 *
38 * @return array
39 * API result array
40 */
41 function activity_get_expectedresult() {
42
43 $expectedResult = [
44 'is_error' => 0,
45 'version' => 3,
46 'count' => 1,
47 'id' => 2,
48 'values' => [
49 '0' => [
50 'id' => '2',
51 'activity_type_id' => '9999',
52 'subject' => 'Make-it-Happen Meeting',
53 'activity_date_time' => '2012-02-16 00:00:00',
54 'duration' => '120',
55 'location' => 'Pennsylvania',
56 'details' => 'a test activity',
57 'status_id' => '1',
58 'priority_id' => '1',
59 'is_test' => 0,
60 'is_auto' => 0,
61 'is_current_revision' => '1',
62 'is_deleted' => 0,
63 'is_star' => 0,
64 'source_contact_id' => '1',
65 ],
66 ],
67 ];
68
69 return $expectedResult;
70 }
71
72 /*
73 * This example has been generated from the API test suite.
74 * The test that created it is called "testGetFilterMaxDate"
75 * and can be found at:
76 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php
77 *
78 * You can see the outcome of the API tests at
79 * https://test.civicrm.org/job/CiviCRM-master-git/
80 *
81 * To Learn about the API read
82 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
83 *
84 * Browse the api on your own site with the api explorer
85 * http://MYSITE.ORG/path/to/civicrm/api
86 *
87 * Read more about testing here
88 * http://wiki.civicrm.org/confluence/display/CRM/Testing
89 *
90 * API Standards documentation:
91 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
92 */