Merge pull request #982 from eileenmcnaughton/apitests
[civicrm-core.git] / api / v3 / examples / Activity / GetTargetandAssignee.php
CommitLineData
6a488035
TO
1<?php
2
3/*
4 Example demonstrates setting & retrieving the target & source
5 */
6function activity__example(){
feb2a730 7$params = array(
6a488035
TO
8 'source_contact_id' => 17,
9 'subject' => 'Make-it-Happen Meeting',
10 'activity_date_time' => '20110316',
11 'duration' => 120,
12 'location' => 'Pensulvania',
13 'details' => 'a test activity',
14 'status_id' => 1,
15 'activity_type_id' => 1,
16 'version' => 3,
17 'priority_id' => 1,
18 'target_contact_id' => 17,
19 'assignee_contact_id' => 17,
20);
21
22 $result = civicrm_api( 'activity','',$params );
23
24 return $result;
25}
26
27/*
28 * Function returns array of result expected from previous function
29 */
30function activity__expectedresult(){
31
feb2a730 32 $expectedResult = array(
6a488035
TO
33 'is_error' => 0,
34 'version' => 3,
35 'count' => 1,
36 'id' => 1,
feb2a730 37 'values' => array(
38 '1' => array(
6a488035 39 'id' => '1',
6a488035
TO
40 'source_record_id' => '',
41 'activity_type_id' => '1',
42 'subject' => 'Make-it-Happen Meeting',
43 'activity_date_time' => '20110316000000',
44 'duration' => '120',
45 'location' => 'Pensulvania',
46 'phone_id' => '',
47 'phone_number' => '',
48 'details' => 'a test activity',
49 'status_id' => '1',
50 'priority_id' => '1',
51 'parent_id' => '',
52 'is_test' => '',
53 'medium_id' => '',
54 'is_auto' => '',
55 'relationship_id' => '',
56 'is_current_revision' => '',
57 'original_id' => '',
58 'result' => '',
59 'is_deleted' => '',
60 'campaign_id' => '',
61 'engagement_level' => '',
62 'weight' => '',
63 ),
64 ),
65);
66
67 return $expectedResult ;
68}
69
70
71/*
72* This example has been generated from the API test suite. The test that created it is called
73*
74* testActivityReturnTargetAssignee and can be found in
75* http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/ActivityTest.php
76*
77* You can see the outcome of the API tests at
78* http://tests.dev.civicrm.org/trunk/results-api_v3
79*
80* To Learn about the API read
81* http://book.civicrm.org/developer/current/techniques/api/
82*
83* and review the wiki at
84* http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
85*
86* Read more about testing here
87* http://wiki.civicrm.org/confluence/display/CRM/Testing
88*
89* API Standards documentation:
90* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
91*/