Merge pull request #127 from dlobo/CRM-12100
[civicrm-core.git] / api / v3 / examples / SurveyCreate.php
1 <?php
2
3 /*
4
5 */
6 function survey_create_example(){
7 $params = array(
8 'version' => 3,
9 'title' => 'survey title',
10 'activity_type_id' => '30',
11 'max_number_of_contacts' => 12,
12 'instructions' => 'Call people, ask for money',
13 );
14
15 $result = civicrm_api( 'survey','create',$params );
16
17 return $result;
18 }
19
20 /*
21 * Function returns array of result expected from previous function
22 */
23 function survey_create_expectedresult(){
24
25 $expectedResult = array(
26 'is_error' => 0,
27 'version' => 3,
28 'count' => 1,
29 'id' => 1,
30 'values' => array(
31 '1' => array(
32 'id' => '1',
33 'title' => 'survey title',
34 'campaign_id' => '',
35 'activity_type_id' => '30',
36 'recontact_interval' => '',
37 'instructions' => 'Call people, ask for money',
38 'release_frequency' => '',
39 'max_number_of_contacts' => '12',
40 'default_number_of_contacts' => '',
41 'is_active' => '',
42 'is_default' => '',
43 'created_id' => '',
44 'created_date' => '20130204224326',
45 'last_modified_id' => '',
46 'last_modified_date' => '',
47 'result_id' => '',
48 'bypass_confirm' => '',
49 'thankyou_title' => '',
50 'thankyou_text' => '',
51 ),
52 ),
53 );
54
55 return $expectedResult ;
56 }
57
58
59 /*
60 * This example has been generated from the API test suite. The test that created it is called
61 *
62 * testCreateSurvey and can be found in
63 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/SurveyTest.php
64 *
65 * You can see the outcome of the API tests at
66 * http://tests.dev.civicrm.org/trunk/results-api_v3
67 *
68 * To Learn about the API read
69 * http://book.civicrm.org/developer/current/techniques/api/
70 *
71 * and review the wiki at
72 * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
73 *
74 * Read more about testing here
75 * http://wiki.civicrm.org/confluence/display/CRM/Testing
76 *
77 * API Standards documentation:
78 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
79 */