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