infra updated incorrectly set public functions to private on payment classes
[civicrm-core.git] / api / v3 / examples / Survey / Create.php
1 <?php
2 /**
3 * @file
4 * Test Generated API Example.
5 * See bottom of this file for more detail.
6 */
7
8 /**
9 * Test Generated example of using survey create API.
10 *
11 *
12 * @return array
13 * API result array
14 */
15 function survey_create_example() {
16 $params = array(
17 'title' => 'survey title',
18 'activity_type_id' => '30',
19 'max_number_of_contacts' => 12,
20 'instructions' => 'Call people, ask for money',
21 );
22
23 try{
24 $result = civicrm_api3('survey', 'create', $params);
25 }
26 catch (CiviCRM_API3_Exception $e) {
27 // Handle error here.
28 $errorMessage = $e->getMessage();
29 $errorCode = $e->getErrorCode();
30 $errorData = $e->getExtraParams();
31 return array(
32 'error' => $errorMessage,
33 'error_code' => $errorCode,
34 'error_data' => $errorData,
35 );
36 }
37
38 return $result;
39 }
40
41 /**
42 * Function returns array of result expected from previous function.
43 *
44 * @return array
45 * API result array
46 */
47 function survey_create_expectedresult() {
48
49 $expectedResult = array(
50 'is_error' => 0,
51 'version' => 3,
52 'count' => 1,
53 'id' => 1,
54 'values' => array(
55 '1' => array(
56 'id' => '1',
57 'title' => 'survey title',
58 'campaign_id' => '',
59 'activity_type_id' => '30',
60 'recontact_interval' => '',
61 'instructions' => 'Call people, ask for money',
62 'release_frequency' => '',
63 'max_number_of_contacts' => '12',
64 'default_number_of_contacts' => '',
65 'is_active' => '',
66 'is_default' => '',
67 'created_id' => '',
68 'created_date' => '2013-07-28 08:49:19',
69 'last_modified_id' => '',
70 'last_modified_date' => '',
71 'result_id' => '',
72 'bypass_confirm' => '',
73 'thankyou_title' => '',
74 'thankyou_text' => '',
75 'is_share' => '',
76 ),
77 ),
78 );
79
80 return $expectedResult;
81 }
82
83 /**
84 * This example has been generated from the API test suite.
85 * The test that created it is called
86 * testCreateSurvey
87 * and can be found in
88 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SurveyTest.php
89 *
90 * You can see the outcome of the API tests at
91 * https://test.civicrm.org/job/CiviCRM-master-git/
92 *
93 * To Learn about the API read
94 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
95 *
96 * Browse the api on your own site with the api explorer
97 * http://MYSITE.ORG/path/to/civicrm/api/explorer
98 *
99 * Read more about testing here
100 * http://wiki.civicrm.org/confluence/display/CRM/Testing
101 *
102 * API Standards documentation:
103 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
104 */