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