CRM-15988 - Mass cleanup of api entity names to CamelCase
[civicrm-core.git] / api / v3 / examples / Mailing / Submit.php
CommitLineData
50fb255d 1<?php
50fb255d 2/**
3 * Test Generated example of using mailing submit API.
4 *
50fb255d 5 * @return array
6 * API result array
7 */
8function mailing_submit_example() {
9 $params = array(
10 'scheduled_date' => '2014-12-13 10:00:00',
11 'id' => 9,
12 );
13
14 try{
15 $result = civicrm_api3('mailing', 'submit', $params);
16 }
17 catch (CiviCRM_API3_Exception $e) {
18 // Handle error here.
19 $errorMessage = $e->getMessage();
20 $errorCode = $e->getErrorCode();
21 $errorData = $e->getExtraParams();
22 return array(
23 'error' => $errorMessage,
24 'error_code' => $errorCode,
25 'error_data' => $errorData,
26 );
27 }
28
29 return $result;
30}
31
32/**
33 * Function returns array of result expected from previous function.
34 *
35 * @return array
36 * API result array
37 */
38function mailing_submit_expectedresult() {
39
40 $expectedResult = array(
41 'is_error' => 0,
42 'version' => 3,
43 'count' => 1,
44 'id' => 9,
45 'values' => array(
46 '9' => array(
47 'id' => '9',
48 'domain_id' => '1',
49 'header_id' => '',
50 'footer_id' => '',
5c49fee0
CW
51 'reply_id' => '8',
52 'unsubscribe_id' => '5',
53 'resubscribe_id' => '6',
54 'optout_id' => '7',
50fb255d 55 'name' => 'mailing name',
56 'from_name' => 'FIXME',
57 'from_email' => 'info@EXAMPLE.ORG',
58 'replyto_email' => 'info@EXAMPLE.ORG',
59 'subject' => 'Hello {contact.display_name}',
5c49fee0
CW
60 'body_text' => 'This is {contact.display_name}.
61{domain.address}{action.optOutUrl}',
62 'body_html' => '<p>This is {contact.display_name}.</p><p>{domain.address}{action.optOutUrl}</p>',
50fb255d 63 'url_tracking' => '1',
64 'forward_replies' => 0,
65 'auto_responder' => 0,
66 'open_tracking' => '1',
67 'is_completed' => '',
68 'msg_template_id' => '',
69 'override_verp' => '1',
70 'created_id' => '22',
71 'created_date' => '2013-07-28 08:49:19',
72 'scheduled_id' => '22',
73 'scheduled_date' => '20130728085413',
74 'approver_id' => '',
75 'approval_date' => '',
76 'approval_status_id' => '',
77 'approval_note' => '',
78 'is_archived' => 0,
79 'visibility' => 'Public Pages',
80 'campaign_id' => '',
5c49fee0 81 'dedupe_email' => '1',
50fb255d 82 'sms_provider_id' => '',
83 'hash' => '67eac7789eaee00',
5c49fee0
CW
84 'location_type_id' => 0,
85 'email_selection_method' => 'automatic',
50fb255d 86 ),
87 ),
88 );
89
90 return $expectedResult;
91}
92
93/**
94* This example has been generated from the API test suite.
95* The test that created it is called
96* testMailerSubmit
97* and can be found in
98* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailingTest.php
99*
100* You can see the outcome of the API tests at
101* https://test.civicrm.org/job/CiviCRM-master-git/
102*
103* To Learn about the API read
104* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
105*
106* Browse the api on your own site with the api explorer
41d4d31f 107* http://MYSITE.ORG/path/to/civicrm/api
50fb255d 108*
109* Read more about testing here
110* http://wiki.civicrm.org/confluence/display/CRM/Testing
111*
112* API Standards documentation:
113* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
114*/