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