fix failing test, check contribution creating with default date of now
[civicrm-core.git] / api / v3 / examples / EventCreate.php
CommitLineData
6a488035 1<?php
fb32de45 2/**
3 * Test Generated example of using event create API
4 * *
6a488035
TO
5 */
6function event_create_example(){
53ca8fd7 7$params = array(
6a488035
TO
8 'title' => 'Annual CiviCRM meet',
9 'summary' => 'If you have any CiviCRM realted issues or want to track where CiviCRM is heading, Sign up now',
10 'description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues',
11 'event_type_id' => 1,
12 'is_public' => 1,
13 'start_date' => 20081021,
14 'end_date' => 20081023,
15 'is_online_registration' => 1,
16 'registration_start_date' => 20080601,
17 'registration_end_date' => '2008-10-15',
18 'max_participants' => 100,
19 'event_full_text' => 'Sorry! We are already full',
20 'is_monetary' => 0,
21 'is_active' => 1,
22 'is_show_location' => 0,
6a488035
TO
23);
24
fb32de45 25try{
26 $result = civicrm_api3('event', 'create', $params);
27}
28catch (CiviCRM_API3_Exception $e) {
29 // handle error here
30 $errorMessage = $e->getMessage();
31 $errorCode = $e->getErrorCode();
32 $errorData = $e->getExtraParams();
33 return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
34}
6a488035 35
fb32de45 36return $result;
6a488035
TO
37}
38
fb32de45 39/**
6a488035
TO
40 * Function returns array of result expected from previous function
41 */
42function event_create_expectedresult(){
43
53ca8fd7 44 $expectedResult = array(
6a488035
TO
45 'is_error' => 0,
46 'version' => 3,
47 'count' => 1,
48 'id' => 3,
53ca8fd7 49 'values' => array(
50 '3' => array(
6a488035
TO
51 'id' => '3',
52 'title' => 'Annual CiviCRM meet',
53 'summary' => 'If you have any CiviCRM realted issues or want to track where CiviCRM is heading, Sign up now',
54 'description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues',
55 'event_type_id' => '1',
56 'participant_listing_id' => '',
57 'is_public' => '1',
9f1b81e0 58 'start_date' => '2013-07-29 00:00:00',
59 'end_date' => '2013-08-04 00:00:00',
6a488035
TO
60 'is_online_registration' => '1',
61 'registration_link_text' => '',
62 'registration_start_date' => '20080601000000',
63 'registration_end_date' => '20081015000000',
64 'max_participants' => '100',
65 'event_full_text' => 'Sorry! We are already full',
66 'is_monetary' => 0,
67 'financial_type_id' => '',
68 'payment_processor' => '',
69 'is_map' => '',
70 'is_active' => '1',
71 'fee_label' => '',
72 'is_show_location' => 0,
73 'loc_block_id' => '',
74 'default_role_id' => '',
75 'intro_text' => '',
76 'footer_text' => '',
77 'confirm_title' => '',
78 'confirm_text' => '',
79 'confirm_footer_text' => '',
80 'is_email_confirm' => '',
81 'confirm_email_text' => '',
82 'confirm_from_name' => '',
83 'confirm_from_email' => '',
84 'cc_confirm' => '',
85 'bcc_confirm' => '',
86 'default_fee_id' => '',
87 'default_discount_fee_id' => '',
88 'thankyou_title' => '',
89 'thankyou_text' => '',
90 'thankyou_footer_text' => '',
91 'is_pay_later' => '',
92 'pay_later_text' => '',
93 'pay_later_receipt' => '',
94 'is_partial_payment' => '',
95 'initial_amount_label' => '',
96 'initial_amount_help_text' => '',
97 'min_initial_amount' => '',
98 'is_multiple_registrations' => '',
99 'allow_same_participant_emails' => '',
100 'has_waitlist' => '',
101 'requires_approval' => '',
102 'expiration_time' => '',
103 'waitlist_text' => '',
104 'approval_req_text' => '',
105 'is_template' => 0,
106 'template_title' => '',
107 'created_id' => '',
f27f2724 108 'created_date' => '2013-07-28 08:49:19',
6a488035
TO
109 'currency' => '',
110 'campaign_id' => '',
111 'is_share' => '',
112 'parent_event_id' => '',
113 'slot_label_id' => '',
114 ),
115 ),
116);
117
fb32de45 118 return $expectedResult;
6a488035
TO
119}
120
121
122/*
123* This example has been generated from the API test suite. The test that created it is called
124*
125* testCreateEventSuccess and can be found in
126* http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/EventTest.php
127*
128* You can see the outcome of the API tests at
129* http://tests.dev.civicrm.org/trunk/results-api_v3
130*
131* To Learn about the API read
132* http://book.civicrm.org/developer/current/techniques/api/
133*
134* and review the wiki at
135* http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
136*
137* Read more about testing here
138* http://wiki.civicrm.org/confluence/display/CRM/Testing
139*
140* API Standards documentation:
141* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
142*/